Repository navigation
Split Buffer's Thue-Morse lastIndexOf stress test out, skip TSan - #8344
Merged
Merged
Conversation
The "expensive reverse searches" in buffer-nodejs-test.js made it take 104-141 s per variant under ThreadSanitizer, against 2-3 s in regular builds. Each of the six searches calls memrchr(3) about 60,000 times on most of a 5 MB buffer. glibc's memrchr stops near the end each time, but sanitizers' memrchr interceptor checks the whole range before searching, so TSan checks about 960 GB of shadow memory. Move those searches unchanged into buffer-reverse-search-nodejs-test, tagged no-tsan. The code is single-threaded, so TSan has nothing to find there. Regular and ASan builds still run it. The remaining buffer-nodejs-test takes about 5 s under TSan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Approved — Test-only change that moves a stress test unchanged into its own target, which TSan builds skip. No issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
Test-only change; no security concerns.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md updates needed.
📋 Code Quality: ✅ LGTM
The block is moved unchanged, and buffer-nodejs-test.js has no leftover references to the removed variables. The no-tsan tag works with the existing TSan tag filters, and wd_test still creates the default, all-compat-flags and all-autogates variants for non-TSan builds.
⚡ Performance: ✅ LGTM
No production code changes.
📝 Documentation: ✅ LGTM
The BUILD comment describes the current reason for skipping TSan.
Reviewed commit: cf7a2a3f
jasnell
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under ThreadSanitizer,
buffer-nodejs-testtook 104–141 s per variant, against 2–3 s in regular builds. Almost all of that time went to the "expensive reverse searches" block: sixlastIndexOfcalls for long prefixes of a 5 MB Thue-Morse buffer. Each call runsmemrchr(3)about 60,000 times, over most of the buffer each time, and finds a match within a few bytes of the end. glibc stops there. Sanitizers'memrchrinterceptor checks the whole range before searching, though (itsmemchrinterceptor checks only up to the match), so TSan checks about 960 GB of shadow memory.This moves that block unchanged into
buffer-reverse-search-nodejs-test, taggedno-tsan. The code is single-threaded, so TSan has nothing to find there. Regular and ASan builds still run it.This replaces #8298, which chunked
MemrchrFillto dodge the interceptor. Benchmarked without a sanitizer on-c opt, that change made productionlastIndexOf25–35% slower when the match is 1–4 KiB from the end, and 12–32% slower on inputs with many candidates. The old code was already linear there, so this PR leaves production code alone.Timings on bazelflare,
--runs_per_test=5:buffer-nodejs-test@buffer-nodejs-test@all-autogatesbuffer-nodejs-test@all-compat-flagsbuffer-reverse-search-nodejs-test@buffer-reverse-search-nodejs-test@all-autogatesbuffer-reverse-search-nodejs-test@all-compat-flagsUnder the TSan tag filter,
bazel testreports "No test targets were found" for the new test's variants.A longer-term fix belongs in compiler-rt: the
memrchrinterceptor could check only[match, end), the waymemchr's does.🤖 Generated with Claude Code