Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore: move measurements out of comments
Elian Doran58bc83898cc1
diff --git a/apps/mobile/android/app/src/main/java/org/triliumnotes/trilium/TriliumFileSink.java b/apps/mobile/android/app/src/main/java/org/triliumnotes/trilium/TriliumFileSink.javaindex 2d1242a296..d484c253da 100644--- a/apps/mobile/android/app/src/main/java/org/triliumnotes/trilium/TriliumFileSink.java+++ b/apps/mobile/android/app/src/main/java/org/triliumnotes/trilium/TriliumFileSink.java@@ -22,7 +22,7 @@ import org.json.JSONObject;** <p>The Capacitor plugin bridge carries binary as base64 inside a JSON string, and the native* side re-parses that whole string per call ({@code MessageHandler} → {@code org.json}), which- * caps file writes at roughly 13 MB/s. This listener receives raw {@code ArrayBuffer} messages+ * is far too slow for large files. This listener receives raw {@code ArrayBuffer} messages* instead — no base64, no JSON around the payload — and appends them to a file on an IO thread.** <p>Protocol, driven by {@code capacitor_download.ts}: a JSON string {@code {"type":"open",diff --git a/packages/trilium-backup-container/src/backend-web.ts b/packages/trilium-backup-container/src/backend-web.tsindex 4f937750ef..425aaee755 100644--- a/packages/trilium-backup-container/src/backend-web.ts+++ b/packages/trilium-backup-container/src/backend-web.ts@@ -9,9 +9,9 @@ import { KEY_BYTES, TAG_BYTES } from "./format.js";/*** The browser backend: AES-256-GCM and randomness from WebCrypto, gzip from the platform's* `CompressionStream`, and the two primitives WebCrypto does not offer from elsewhere — scrypt- * from `@noble/hashes`, incremental SHA-256 from `hash-wasm`. The hash is WASM rather than- * `@noble`'s pure JS because it runs over every payload byte and paced a phone's backup at about- * 32 MB/s; scrypt stays JS because it runs once per container. Runs under Node just as well,+ * from `@noble/hashes`, incremental SHA-256 from `hash-wasm`. The hash is WASM rather than pure+ * JS because it runs over every payload byte, where the JS penalty on a phone paces the whole+ * backup; scrypt stays JS because it runs once per container. Runs under Node just as well,* which is how the cross-backend tests exercise it.** WebCrypto's `subtle` interface only exists in secure contexts (HTTPS, localhost, workers ofdiff --git a/packages/trilium-core/src/services/sql/sql.ts b/packages/trilium-core/src/services/sql/sql.tsindex c2b680e3fe..6093aa5159 100644--- a/packages/trilium-core/src/services/sql/sql.ts+++ b/packages/trilium-core/src/services/sql/sql.ts@@ -242,12 +242,10 @@ export class SqlService {/*** Gets every row of a whole-table read as a positional array, the way {@link getRawRows} does,- * but crossing between JavaScript and the database once instead of once per column.- *- * `@sqlite.org/sqlite-wasm` charges roughly 7µs per column a row exposes, so the Becca- * load spends most of its time marshalling rather than querying. `json_group_array()`- * hands the result set over as one value, which `JSON.parse()` turns into rows about ten- * times faster; better-sqlite3 is marginally faster this way too.+ * but crossing between JavaScript and the database once instead of once per column: under+ * `@sqlite.org/sqlite-wasm` every column read is its own wasm round trip, so a wide+ * whole-table read spends most of its time marshalling. `json_group_array()` hands the+ * result set over as one value for `JSON.parse()`.** Going through JSON puts two limits on `columns` that {@link getRawRows} does not have:* `json_array()` rejects a BLOB column, and an integer above `Number.MAX_SAFE_INTEGER`