Skip to content

Build your personal knowledge base with Trilium Notes

perf(desktop): enable V8 code cache for the trilium-app:// scheme

Elian Doran898dd5776a41
diff --git a/apps/desktop/src/protocol.spec.ts b/apps/desktop/src/protocol.spec.ts
index ba882fe1a5..d1af4f0a45 100644
--- a/apps/desktop/src/protocol.spec.ts
+++ b/apps/desktop/src/protocol.spec.ts
@@ -439,7 +439,7 @@ describe("trilium-app protocol dispatcher", () => {
expect(electronMock.registerSchemesAsPrivileged).toHaveBeenCalledWith([
expect.objectContaining({
scheme: "trilium-app",
- privileges: expect.objectContaining({ standard: true, secure: true, supportFetchAPI: true, corsEnabled: true })
+ privileges: expect.objectContaining({ standard: true, secure: true, supportFetchAPI: true, corsEnabled: true, codeCache: true })
})
]);
});
diff --git a/apps/desktop/src/protocol.ts b/apps/desktop/src/protocol.ts
index 0025468373..2cc057b278 100644
--- a/apps/desktop/src/protocol.ts
+++ b/apps/desktop/src/protocol.ts
@@ -31,7 +31,11 @@ export function registerTriliumAppScheme() {
standard: true,
secure: true,
supportFetchAPI: true,
- corsEnabled: true
+ corsEnabled: true,
+ // Chromium only code-caches http(s) scripts by default; without
+ // this the renderer bundle is recompiled from source on every
+ // launch instead of reusing bytecode from the Code Cache dir.
+ codeCache: true
}
}
]);