Open
Bug 1665331
Opened 4 years ago
Updated 15 days ago
Replace Canonical JSON JavaScript implementation with canonical_json Rust crate
Categories
(Firefox :: Remote Settings Client, enhancement)
Firefox
Remote Settings Client
Tracking
()
NEW
People
(Reporter: leplatrem, Unassigned, NeedInfo)
References
Details
In order to share the same Canonical JSON serializer implementation between the server and the clients, we can replace the current toolkit/modules/CanonicalJSON.jsm
with the canonical_json
crate.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1659419
And https://blog.mathieu-leplatre.info/leveraging-rust-in-python-and-javascript.html
Reporter | ||
Comment 1•15 days ago
|
||
I would be interested to know the performance impact of canonical json serialization of huge collections like security-state/intermediates
, and see whether it would make sense to replace the current code with our Rust crate.
On my modern machine, it seems reasonable:
>> const { RemoteSettingsWorker } = ChromeUtils.importESModule("resource://services-settings/RemoteSettingsWorker.sys.mjs");
>> const resp = await fetch("https://firefox.settings.services.mozilla.com/v1/buckets/security-state/collections/intermediates/changeset?_expected=00000");
>> const {changes: records, timestamp} = await resp.json();
>> console.time("cjson"); await Promise.all(Array(500000).map(() => RemoteSettingsWorker.canonicalStringify(records, timestamp))); console.timeEnd("cjson");
10:46:29.478 cjson: 687.18ms - timer ended
But how to measure how it would affect browsing and battery on modest devices?
Flags: needinfo?(florian)
You need to log in
before you can comment on or make changes to this bug.
Description
•