mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 12:13:45 +00:00
add measurements
This commit is contained in:
20
apps/browser/index.html
Normal file
20
apps/browser/index.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html class="browser_chrome">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Bitwarden</title>
|
||||
<base href="" />
|
||||
<script src="../popup/performance-mark.js"></script>
|
||||
<script defer src="../popup/polyfills.js"></script>
|
||||
<script defer src="../popup/vendor.js"></script>
|
||||
<script defer src="../popup/vendor-angular.js"></script>
|
||||
<script defer src="../popup/main.js"></script>
|
||||
<link href="../popup/main.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<app-root>
|
||||
<div id="loading"><i class="bwi bwi-spinner bwi-spin bwi-3x" aria-hidden="true"></i></div>
|
||||
</app-root>
|
||||
</body>
|
||||
</html>
|
||||
2
apps/browser/performance-mark.js
Normal file
2
apps/browser/performance-mark.js
Normal file
@@ -0,0 +1,2 @@
|
||||
console.log("html-loaded");
|
||||
performance.mark("html-loaded");
|
||||
@@ -23,6 +23,7 @@ if (process.env.ENV === "production") {
|
||||
}
|
||||
|
||||
function init() {
|
||||
performance.mark("angular-bootstrap-start");
|
||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true });
|
||||
|
||||
@@ -28,6 +28,7 @@ export class InitService {
|
||||
) {}
|
||||
|
||||
init() {
|
||||
performance.mark("init-start");
|
||||
return async () => {
|
||||
await this.sdkLoadService.load();
|
||||
await this.stateService.init({ runMigrations: false }); // Browser background is responsible for migrations
|
||||
@@ -56,6 +57,7 @@ export class InitService {
|
||||
}
|
||||
|
||||
this.setupVaultPopupHeartbeat();
|
||||
performance.mark("init-end");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ export class VaultV2Component implements OnInit, AfterViewInit, OnDestroy {
|
||||
private cipherService: CipherService,
|
||||
private dialogService: DialogService,
|
||||
) {
|
||||
performance.mark("vault-v2-ctor-start");
|
||||
combineLatest([
|
||||
this.vaultPopupItemsService.emptyVault$,
|
||||
this.vaultPopupItemsService.noFilteredResults$,
|
||||
|
||||
@@ -177,6 +177,8 @@ export class VaultPopupItemsService {
|
||||
shareReplay({ refCount: false, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
hasMarked = false;
|
||||
|
||||
/**
|
||||
* List of all remaining ciphers that are not currently suggested for autofill or marked as favorite.
|
||||
* Ciphers are sorted by name.
|
||||
@@ -193,6 +195,18 @@ export class VaultPopupItemsService {
|
||||
(cipher) => !autoFillCiphers.includes(cipher) && !favoriteCiphers.includes(cipher),
|
||||
),
|
||||
),
|
||||
tap((ciphers) => {
|
||||
if (ciphers.length === 0 || this.hasMarked) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.hasMarked) {
|
||||
this.hasMarked = true;
|
||||
}
|
||||
|
||||
performance.mark("vault-v2-ciphers-available");
|
||||
console.log("Ciphers available", ciphers);
|
||||
}),
|
||||
shareReplay({ refCount: false, bufferSize: 1 }),
|
||||
);
|
||||
|
||||
|
||||
24
console.log.js
Normal file
24
console.log.js
Normal file
@@ -0,0 +1,24 @@
|
||||
console.log(
|
||||
`Popup triggered -> HTML loaded: ${Math.round(
|
||||
performance.measure("", {}, "html-loaded").duration,
|
||||
)} ms\n` +
|
||||
`Popup triggered -> Angular bootstrap start: ${Math.round(
|
||||
performance.measure("", {}, "angular-bootstrap-start").duration,
|
||||
)} ms\n` +
|
||||
`Popup triggered -> InitService start: ${Math.round(
|
||||
performance.measure("", {}, "init-start").duration,
|
||||
)} ms\n` +
|
||||
// `Popup triggered -> cipher decryption start: ${Math.round(
|
||||
// performance.measure("", {}, "cipher-decryption-start").duration
|
||||
// )} ms\n` +
|
||||
// `Popup triggered -> cipher decryption end: ${Math.round(
|
||||
// performance.measure("", {}, "cipher-decryption-end").duration
|
||||
// )} ms\n` +
|
||||
`Popup triggered -> VaultV2Component constructor start: ${Math.round(
|
||||
performance.measure("", {}, "vault-v2-ctor-start").duration,
|
||||
)} ms\n` +
|
||||
`Popup triggered -> VaultPopupItemsService first emission: ${Math.round(
|
||||
performance.measure("", {}, "vault-v2-ciphers-available").duration,
|
||||
)} ms\n` +
|
||||
``,
|
||||
);
|
||||
@@ -406,6 +406,10 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
return await this.getDecryptedCiphers();
|
||||
}
|
||||
|
||||
// if (!(window as any).markedCipherDecryptionStart) {
|
||||
// performance.mark("cipher-decryption-start");
|
||||
// (window as any).markedCipherDecryptionStart = true;
|
||||
// }
|
||||
const activeUserId = await firstValueFrom(this.stateProvider.activeUserId$);
|
||||
|
||||
if (activeUserId == null) {
|
||||
@@ -420,6 +424,11 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
await this.setDecryptedCipherCache(newDecCiphers, activeUserId);
|
||||
await this.setFailedDecryptedCiphers(failedCiphers, activeUserId);
|
||||
|
||||
// if (!(window as any).markedCipherDecryptionEnd) {
|
||||
// performance.mark("cipher-decryption-end");
|
||||
// (window as any).markedCipherDecryptionEnd = true;
|
||||
// }
|
||||
|
||||
return newDecCiphers;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user