docs(docs): RUST.md §10.4 browser results of the Rust import; TODO R4.2 closed, journal

This commit is contained in:
bchanot committed 2026-10-18 16:59:37 +02:00
1 parent c84186b032
commit 6deee65b79
3 files changed
+93 -2

No files matched your search

+89
View File
@@ -1194,3 +1194,92 @@ Residual risks and open points for the owner (R4.2 checkpoint):
- The probe parses the candidate twice (version check, then the session),
as the TypeScript did; the peak is one tree since the first is dropped. A
single parse would need the gated session reader to take a value.
### 10.4 R4.2: the Rust import in the browsers (2026-10-18, `scripts/browser/results/2026-10-18-r4-import.json`)
Harness `scripts/browser/r4-import.mjs` (README there): the shape plan §B.1.5
gives the application at R4.3, a module worker created for one import, the
compiled `WebAssembly.Module` posted by the main thread, the `File` read in
the worker, one `SheetHandle.import_pdf`, the worker terminated; the same
226 files, engines, groups and RSS metrics as the TypeScript baseline of
10.2 (`compare-imports.mjs` prints both side by side). Chromium 156 headless
shell, Firefox 157, WebKit 27.2 (WPE), headless only; the 4 GiB RSS watchdog
is not a guaranteed memory limit. Module `ba070c29…`, 1,252,727 B, memory
maximum 16,384 pages (1 GiB).
Agreement: 666 of 678 (engine, file) pairs give the same outcome as the TS
import (editor ↔ `ok`, error ↔ a failure kind). The 12 others are the four
declared files in each engine: `values-1m` (OD-3), `surrogate-content-
overwritten`, `surrogate-version-overwritten`, `two-files-decoy-first`
(OD-4). Mapped to the §B.1.8 messages, no other difference.
Legitimate groups, TS → Rust (median ms on the Node clock, with the Rust
page clock after the slash; max RSS growth MiB summed / content):
| Engine | base | r3 | step6 | tolerance | read |
|---|---|---|---|---|---|
| Chromium ms | 53 → 65 / 32 | 63 → 80 / 43 | 61 → 65 / 41 | 57 → 63 / 31 | 66 → 68 / 29 |
| Chromium MiB | 28 / 23 → 17 / 15 | 44 / 38 → 16 / 16 | 39 / 33 → 17 / 17 | 105 / 99 → 18 / 16 | 75 / 68 → 117 / 115 |
| Firefox ms | 39 → 67 / 22 | 73 → 55 / 30 | 69 → 54 / 28 | 53 → 46 / 21 | 78 → 45 / 21 |
| Firefox MiB | 63 / 14 → 52 / 9 | 54 / 33 → 60 / 35 | 52 / 32 → 52 / 26 | 153 / 131 → 58 / 35 | 86 / 61 → 154 / 127 |
| WebKit ms | 52 → 45 / 25 | 62 → 55 / 37 | 66 → 50 / 33 | 59 → 44 / 26 | 75 → 43 / 24 |
| WebKit MiB | 52 / 50 → 61 / 59 | 54 / 52 → 71 / 67 | 53 / 51 → 60 / 59 | 102 / 100 → 70 / 67 | 101 / 99 → 324 / 299 |
The durations are not strictly like for like: the TS baseline ran the whole
application (the core loads during the import), the Rust page compiles the
module at page load (8 to 25 ms) and builds a `SheetHandle` per import
(about 21 ms in Chromium). The hostile `tolerance` group costs a fifth of
the TS memory under Rust. The `read` group costs more: its 20 to 50 MiB
inputs are held twice in the worker, the `File`'s ArrayBuffer and the glue's
copy in linear memory (54 MiB), and WebKit adds more on top
(`size-exactly-50mib`: Chromium 117 against 56 MiB, Firefox 154 against 79,
WebKit 324 against 76). R4.3 releases the buffer after the copy or reads the
file in chunks. Chromium main-thread long tasks during the imports: 0 (W5).
Hostile classes, Rust (Chromium / Firefox / WebKit; linear memory is the
instance's, the same in every engine; the GC delta is Chromium's content
process after the worker is terminated and a GC forced):
| Class | Outcome | Page ms | Summed peak MiB | Content peak MiB | Linear MiB | GC delta MiB |
|---|---|---|---|---|---|---|
| L envelope | ok | 46 / 36 / 45 | 4 / 11 / 9 | 6 / 9 / 7 | 4.6 | 11.7 |
| CAP envelope | ok | 88 / 77 / 83 | 31 / 20 / 39 | 29 / 18 / 35 | 13.9 | 14.2 |
| 16 MiB dense numbers | attachment_stripped | 183 / 199 / 130 | 45 / 47 / 124 | 47 / 45 / 114 | 20.0 | 11.8 |
| 16 MiB dense strings | attachment_stripped | 153 / 188 / 122 | 43 / 48 / 122 | 47 / 45 / 113 | 20.0 | 11.1 |
| 16 MiB at depth 64 | attachment_stripped | 180 / 198 / 136 | 45 / 47 / 123 | 48 / 45 / 114 | 20.0 | 12.2 |
| 16 MiB rescue copy | invalid | 178 / 190 / 164 | 113 / 145 / 234 | 115 / 143 / 225 | 52.0 | 15.4 |
| 16 MiB inflation | attachment_stripped | 43 / 37 / 43 | 20 / 12 / 13 | 18 / 10 / 11 | 35.3 | 11.1 |
| 16 MiB + 1 bomb | attachment_stripped | 50 / 44 / 49 | 5 / 8 / 10 | 7 / 7 / 8 | 67.3 | 12.1 |
| 32 bombs | attachment_stripped | 218 / 221 / 203 | 68 / 64 / 81 | 66 / 61 / 77 | 67.9 | 12.6 |
| 50 MiB file | no_attachment | 176 / 217 / 127 | 113 / 115 / 317 | 115 / 113 / 295 | 53.9 | 11.3 |
- W4: linear memory at most 67.9 MiB on every hostile class (budget 256).
- The ceiling: in the three engines, `allocate_for_test(256)` returns and
`allocate_for_test(1100)` throws `RuntimeError` (proofs build, linear
257 MiB). Cap off, the 16 MiB dense document reaches 788 MiB of linear
memory and 817 to 851 MiB of content-process peak in about 1 s; with the
cap, 45 to 114 MiB.
- Worker start, median (max): Chromium 6.3 (40.6) ms, Firefox 10.0 (20.0),
WebKit 5.0 (8.0). W2: the L envelope imports in 46 ms page-to-result in
Chromium, CAP in 88 ms. The structured clone of the compiled Module works
in the three engines (236 of 236 workers ready from the clone). No CSP
violation in any page or worker under the production policy with
`'wasm-unsafe-eval'`.
- The §B.3 "content process back within 10 MiB after GC" check is not met
as written on a first import: 3 of 238 Chromium runs; the median delta is
11.7 MiB (7.3 to 13.3; hostile max 15.4). It is a one-time cost, not a
leak: three imports in one page give +11.6, +1.9, −0.2 MiB (L) and +11.0,
+1.4, +0.2 (dense); an empty module worker leaves about 2 MiB, an
instantiated one 3.7, the cloned Module is not the cause (the same without
it). Firefox and WebKit got 5 s idle only (indicative: Firefox +4.8 then
flat, WebKit +24.5 / +43.2 then down to −3). Owner decision: the criterion
counts the first import, or the growth per import.
- Seen once in a WebKit smoke run before the full run: 2 of 3 repeated
imports of the 16 MiB dense document ended with a worker `error` event,
text not captured then; not reproduced in two targeted reruns nor in the
full run (0 failures across 242 WebKit workers). Error text is captured
now; to watch at J1.
Not measured: real devices and browsers (J1), forced GC in Firefox and
WebKit, CPU throttling, the hostile classes on the TS side, the negative
CSP proof (without the keyword), the application's own worker (R4.3).