Skip to content

v0.1.1 — a measured decode win, and a page that can tell a tie from a loss

Latest

Choose a tag to compare

@antst antst released this 24 Aug 08:48
· 2 commits to main since this release
2197f3e

v0.1.1 — a measured decode win, and a page that can tell a tie from a loss

No API change. internal/apicontract/testdata/public_api.txt is byte-identical to
v0.1.0, so this is a drop-in patch: move the pin and nothing else.

THE DECODE FIX. stallGuard.progressed proves a struct read made progress. A
positive clock advance is by itself sufficient proof — but it was evaluated
SECOND, so every ordinary Item summed all nine V2 column streams plus the rest
buffer before reaching the cheap test that would have short-circuited it. On a
10,000-struct update that is 10,000 redundant nine-stream scans.

Reordering the && operands is worth 3-4% on ApplyV1 and ApplyV2, and the
equivalence is structural rather than empirical: with &&, the boolean result is
order-independent by definition, and every operand bottoms out in a length read —
decoderRemaining -> RemainingLen -> nine .remaining() calls -> buf.Len(). Nothing
mutates decoder state, so the guard fires on exactly the same inputs. The
accompanying test was verified to FAIL on the old ordering before it was accepted.

Measured under BOTH GC regimes, deliberately: -4 to -7% decode / -3 to -4% Apply
under normal GC, -5.6% / -2 to -3% under GOGC=off. In the same investigation,
presizing the destination struct store won under GOGC=off and LOST 5-11% under
normal GC — the extra live pointer-bearing array cost more in scan time than it
saved in growth. A single-regime measurement would have shipped that as an
improvement.

WHAT THIS DOES NOT DO. It does not close the ApplyV2 gap to yjs, and nobody should
read it as fixing a slow codec. Measured in one session on one host, ApplyV2 is
about 1.12x yjs; ApplyV1 we win at 0.83x. Of our 1.80 ms decode, roughly 0.33 ms
is actual V2 column scanning and about 1.16 ms is Go object-graph materialisation.
yjs materialises the same graph eagerly, so the comparison is honest — the residual
is V8's monomorphic constructor loop against Go's large pointer-bearing structs and
interfaces. That is a property of the two runtimes, not a defect here. Integration,
where most optimisation effort went, is at parity.

THE PERFORMANCE PAGE now ships at docs/performance-status.html and has a parity
band. It previously called every ratio below 1.00x a loss — so a 0.99x dead heat
rendered red — and everything under 1.50x "thin", so a real 1.4x lead looked like a
tie. Below 0.85x is now a clear loss, 0.85-1.15x is parity, above 1.15x is a clear
win. The band is +/-15% because run-to-run spread reaches 20% on the JS side alone;
inside it the harness cannot separate the two implementations. On current data: red
26 -> 12, green 125 -> 142.

Its numbers come from a single-session four-leg run. Every ratio quoted before this
spliced a fresh go column against competitor columns measured a week earlier on a
different CPU allocation, and that splice reported ApplyV2 as 1.33x where an
in-session run puts it at 1.12x. run-all.sh's header has always warned that columns
from different windows are not comparable.

DOCUMENTATION CORRECTIONS, each of which promised more than the code delivered:
README and SECURITY.md claimed the oracle runs both directions on all thirteen
surfaces — eight do, and undo, relative positions, sync, awareness and subdocuments
are direction A only, so bytes this library EMITS are not differentially validated
on those. persistence.Deleter now states what Invalidate does not exclude before a
durable delete. Plus stale identifiers the v0.1.0 rename sweep could not reach,
because prose is not compiled.