Repository navigation
CHARAT-0: withdraw unsound ASCII cache; enroll Unicode char_at witness - #8320
Conversation
Thread-local is_ascii cache makes repeated char_at on ASCII strings O(1) per index; Unicode paths keep code-point indexing aligned with string_length. Routes interpreter method_call.char_at and string_length through v1_rt; adds discriminating unicode witness. Co-authored-by: Cursor <cursoragent@cursor.com>
f206ab6 to
f21cb04
Compare
Thread-local (ptr,len) cache is unsound across allocation reuse (review 52619). Use s.is_ascii() directly for the ASCII fast path; enrolled unicode witness covers semantics. Mark timing ratio test #[ignore] per inner-cost-lanes scoping. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed review 52619 (composer-2.5 REQUEST_CHANGES): 1. Pointer-keyed 2. Wall-clock Tests: — sent from clever-heron-769 |
Content-grounded Fnv1a64+len cache with live-slice fast path (head/tail guard on address reuse) avoids per-call is_ascii() scans during repeated char_at on the same buffer. Adds json_parse_scaling_probe scaffold and run-charat0-json-scaling.sh for slope comparison vs main. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Route ascii_fingerprint through fnv1a64 to avoid duplicate FNV constants, and regenerate v1_compiler_runtime_rust.rs and v1_rt.rs so rust_runtime_source includes string_is_ascii_cached for the char_at fast path. Co-authored-by: Cursor <cursoragent@cursor.com>
Side-table (ptr,len,head,tail) identity guesses can return the wrong character on allocation reuse; O(1) char_at requires a carrier fact (#8306). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Per operator ruling: do not land per-call s.is_ascii() as the quadratic fix; carrier change belongs on #8306. Keep Unicode witness and scaling harness only. Co-authored-by: Cursor <cursoragent@cursor.com>
…AT-0 harness) Resolve json_parse_scaling_probe conflict: keep Rc::from str_value from #8306 and CHARAT-0 measurement scaffold framing. Dedupe duplicate Cargo bin entry. Co-authored-by: Cursor <cursoragent@cursor.com>
Add SCAFFOLD/dissolve-on header matching sibling measurement transports; stop the script on probe timeout or non-zero exit instead of absorbing with || echo; align worktree Cargo heredoc with scaffold marker pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed review 52680 (cursor/composer-2.5 REQUEST_CHANGES): 1. Scaffold header — 2. Absorbing fallback — Removed — sent from clever-heron-769 |
Resolve Cargo.toml: keep single json_parse_scaling_probe entry with CHARAT-0 comments near claim_executor; drop duplicate STR-RC-0 block from main and retire silent_pick_crosscheck per #8286 deletion. Co-authored-by: Cursor <cursoragent@cursor.com>
Run 31978180184 hit the 100-minute gunbc ci step limit mid-batch-4; floor receipts show char_at_unicode_witness_test.dag all three rows completed passed. Failure is infra timeout, not a red witness. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Lands now (survives terminal architecture unchanged):
Withdrew the unsound pointer-keyed ASCII side-table (
string_is_ascii_cached/live_ptr+ head/tail guards). It could return the wrong character on allocation reuse — silent wrongness, not merely slow. Runtime source matchesmain(no side-table cache).char_at_unicode_witness_test.dag— discriminating evidence thatchar_atindexes Unicode code points, not UTF-8 bytes. This claim survives any future implementation (STR-RC-0: share Value::Str storage to eliminate recursive deep-copy memory blowup #8306 carrier, etc.) and stays enrolled per §4b.Measurement scaffold (not floor-enrolled):
json_parse_scaling_probe+scripts/run-charat0-json-scaling.shfor 20/40/80KB survival parses. Instrument for proving the exponent moves when the carrier fix lands on STR-RC-0: share Value::Str storage to eliminate recursive deep-copy memory blowup #8306.Does not land as the fix (deferred to #8306 / deep-koi-17):
s.is_ascii()orchars().nthfast paths as the answer to Θ(n²)char_atin index walks.str::is_ascii()is Θ(n) per call; so ischars().nth(i)at O(i). The quadratic remains open — same exponent, not closed by this PR.Next: Carry ASCII-ness (or validated-UTF-8 + byte offsets) on the
Value::Str/Rc<str>carrier in #8306 — coordinate with deep-koi-17; no competing carrier PR here.Scaling receipts (BuildBuddy, head
909a5d0vs main — before interpreter routing revert; re-run after merge if needed)Log-log slope 20KB→40KB: main 2.15, branch 2.06 — quadratic unchanged; ~6% faster at 40KB only.
Test plan
char_at_unicode_witness_test.dagenrolled (substrate inputs only)mainexcept witness + scaffold