Repository navigation
Skip UTF-16 REPLACE work for absent whole-string literals - #706
Conversation
The zabapgit CPU profile attributed 40.63% inclusive CPU to ReplaceStmt, with count16 at 8.17% flat and hasHalf at 4.47% flat. Literal REPLACE chains repeatedly pay UTF-16 length and section costs for absent patterns. Add one strings.Index before UTF-16 processing. Return the unchanged subject and sy-subrc 4 only for a nonempty case-sensitive non-regex pattern, a string target (cLen < 0), offset 0, omitted length (NoLength), subject byte length <= MaxInt32, and no WTF-8 surrogate halves in either operand. FIRST and ALL share this no-match result. Keep present patterns, fixed c targets, explicit sections, IGNORING CASE, regex, and empty/half patterns on the existing path. Byte mode/PCRE and JS remain unchanged. REPLACEMENT COUNT/OFFSET/LENGTH/LINE remain unsupported by the frontend. Retain the slow implementation behind a per-call test seam, without global state. Compare value, subrc, and exception type/text in 2,286 table cases: absent/present, c/string, valid/invalid sections, FIRST/ALL, Unicode case folds, halves, empty patterns, regex and truncation. Independently assert unchanged subjects and subrc 4. Compiling an overlay that returns subrc 0 makes TestReplaceAbsentFields fail as required; the real source passes. Checks: go test ./abap/... exit 0; full node tools/gogen/semantics.mjs 394 ok, 0 FAIL, exit 0; size budget --changed origin/main exit 0 (two inherited notices); leak scan of both changed files: 0 hits, exit 0; git diff --check clean. Keep strings.go at its existing 636-line ceiling. Go benchmarks, median of three 300ms samples, retained slow -> fast, eight rotating ASCII subjects, FIRST present case: 1024 bytes, present=false: 448 -> 165.6 ns/op (2.71x) 1024 bytes, present=true: 1050 -> 1067 ns/op (0.98x) 65536 bytes, present=false: 21361 -> 8379 ns/op (2.55x) 65536 bytes, present=true: 39311 -> 41019 ns/op (0.96x) Absent fast path allocates 0 B/op; present allocations remain unchanged. Optional end-to-end: compile the read-only abapiti native input with this branch and origin/main e7dd62c into isolated output trees. Each build reports 2,127 classes and 199 stubs. Clean copied kit, --times, GOGC=400, two runs each: main 25.60/23.12 s; branch 22.83/22.94 s. All exit 0 and first output line 0. Report raw times under varying host load, without a statistical speedup claim. Heavy runs use nice -n10, GOFLAGS=-buildvcs=false, the supplied shared GOCACHE and RAM scratch, instance range 50-59, and the resource gates. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VUy1x5QYimNEytFZpg7t7S
|
Preview: open the launchpad - the OData gateway, the demo and Zork run in your browser, no server. Screenshots - built from |
PR tests: 🟢 passCommit:
ADT lifecycle: PASSCommit: b02a589 · SDK 8.4.3 · VSP baac6f4c97fb3ea1dee9b7772e24d52855af2985 124 PASS, 4 N/A, 3 MISSING Functional operations, active readback, cleanup and warm-swap checks determine the required gate. Timing advisory: QUIETClient wall time in ms. VSP update includes Check and Activate. Cold REPORT/DDLS are measured too. Parallel CI job; operations within each server are sequential. Reference: median of ABAP-FS/CLAS/edit, ABAP-FS/CLAS/readback-active, ABAP-FS/INTF/edit, ABAP-FS/INTF/readback-active; current 53.5 ms. History: 1/5 compatible green main runs (newest first; fewer when unavailable). Each run is normalized by its own reference before taking the main median.
Warn when at least 2 operations exceed 1.3x, or any operation reaches 2x. Timing never fails the CI gate.
Required merge checks: test + scan. ADT lifecycle timing, Docker, gogen, preview, size and queue are advisory on PRs; lifecycle functional checks remain required (Alice, 2026-10-07). |
The zabapgit CPU profile attributed 40.63% inclusive CPU to ReplaceStmt,
with count16 at 8.17% flat and hasHalf at 4.47% flat. Literal REPLACE
chains repeatedly pay UTF-16 length and section costs for absent patterns.
Add one strings.Index before UTF-16 processing. Return the unchanged
subject and sy-subrc 4 only for a nonempty case-sensitive non-regex
pattern, a string target (cLen < 0), offset 0, omitted length (NoLength),
subject byte length <= MaxInt32, and no WTF-8 surrogate halves in either
operand. FIRST and ALL share this no-match result. Keep present patterns,
fixed c targets, explicit sections, IGNORING CASE, regex, and empty/half
patterns on the existing path. Byte mode/PCRE and JS remain unchanged.
REPLACEMENT COUNT/OFFSET/LENGTH/LINE remain unsupported by the frontend.
Retain the slow implementation behind a per-call test seam, without global
state. Compare value, subrc, and exception type/text in 2,286 table cases:
absent/present, c/string, valid/invalid sections, FIRST/ALL, Unicode case
folds, halves, empty patterns, regex and truncation. Independently assert
unchanged subjects and subrc 4. Compiling an overlay that returns subrc 0
makes TestReplaceAbsentFields fail as required; the real source passes.
Checks: go test ./abap/... exit 0; full node tools/gogen/semantics.mjs
394 ok, 0 FAIL, exit 0; size budget --changed origin/main exit 0 (two
inherited notices); leak scan of both changed files: 0 hits, exit 0;
git diff --check clean. Keep strings.go at its existing 636-line ceiling.
Go benchmarks, median of three 300ms samples, retained slow -> fast,
eight rotating ASCII subjects, FIRST present case:
1024 bytes, present=false: 448 -> 165.6 ns/op (2.71x)
1024 bytes, present=true: 1050 -> 1067 ns/op (0.98x)
65536 bytes, present=false: 21361 -> 8379 ns/op (2.55x)
65536 bytes, present=true: 39311 -> 41019 ns/op (0.96x)
Absent fast path allocates 0 B/op; present allocations remain unchanged.
Optional end-to-end: compile the read-only abapiti native input with this
branch and origin/main e7dd62c into
isolated output trees. Each build reports 2,127 classes and 199 stubs.
Clean copied kit, --times, GOGC=400, two runs each: main 25.60/23.12 s;
branch 22.83/22.94 s. All exit 0 and first output line 0. Report raw times
under varying host load, without a statistical speedup claim.
Heavy runs use nice -n10, GOFLAGS=-buildvcs=false, the supplied shared
GOCACHE and RAM scratch, instance range 50-59, and the resource gates.
Kit (abapiti perf/upper-ascii input, zabapgit check kit) with this branch: clean equal to Node (0 issues, 22 s), seeded equal to Node (5 issues, 23 s).
Codex worker; codex critic one round: MERGE.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VUy1x5QYimNEytFZpg7t7S