Files
rose-ash/spec
giles 0e022ab670 sx: step 13 — buffer primitives + buffer-based inspect
Added short aliases make-buffer / buffer? / buffer-append! / buffer->string /
buffer-length on both OCaml and JS hosts, sharing the existing StringBuffer
value type. buffer-append! auto-coerces non-strings via inspect.

Rewrote the OCaml host inspect function to walk a single shared Buffer.t
instead of allocating O(n) intermediate strings via String.concat at every
recursion level. inspect underlies sx-serialize and error-path formatting,
so this benefits the tightest serialization paths.

Median improvements (bin/bench_inspect.exe, best-of-3 of 9-run min):
  tree-d8 (75KB):    5.31ms -> 1.30ms  (-76%)
  tree-d10 (679KB): 81.89ms -> 16.02ms (-80%)
  dict-1000:         0.80ms -> 0.31ms  (-61%)
  list-2000:         0.74ms -> 0.33ms  (-55%)

Tests: OCaml 4545 -> 4550. JS 2591 -> 2596. Zero regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 02:16:59 +00:00
..