Skip to content

perf(stringlib): build gsub results in one linear pass - #49

Draft
wolfy-j wants to merge 1 commit into
mainfrom
perf/gsub-linear-replace
Draft

wolfy-j wants to merge 1 commit into
mainfrom
perf/gsub-linear-replace

Conversation

@wolfy-j

@wolfy-j wolfy-j commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Build string.gsub results with one strings.Builder pass over source gaps and replacements.
Randomized differential tests cover string, table, and function replacements; fixed cases cover captures, anchors, empty matches, limits, and count.
go test -race ./... and go vet ./... pass.

Direct replacement timings (Ryzen 9 7950X3D, one iteration):
100 KB / 10k matches: 820.7 ms before → 0.12 ms after.
200 KB / 20k matches: 3044.4 ms before → 0.24 ms after.
1 MB / 100k matches: 75.0 s before → 3.2 ms after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants