Repository navigation
Conversation
content.Scanner.Next classes bytes with a table of its own, the classes of package syntax with the comment sign and the bytes that start a number apart, and reads a number itself, putting it on the operand stack where it is made, rather than through operand, whose result was copied twice. The arrays of TJ read their numbers the same way. The other operands are read as before. What it gives is unchanged: TestSameAsBefore and FuzzSameAsBefore compare it, operator by operator, with the reader as it was, kept in the test; and the JSON of all 3,253 files of the corpus cache and the fixtures has the same hash as on main. The tokeniser took 16 percent of the time to read the tuning set of the public corpus on one worker, and takes 10; the tuning set takes 4.5 percent fewer instructions (17.31 G to 16.52 G), BenchmarkScanner 20 percent fewer (47.6 M to 37.9 M). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DzYLyEzLqkwuqPQ9LXgMpD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DzYLyEzLqkwuqPQ9LXgMpD
This was referenced Nov 22, 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.
The speed item from the profiling that's worth doing on batch workloads. No change to output.
Why this one. I profiled one worker reading the 1,089 files of the public corpus's tuning set:
A faster Unicode-map reader could save at most 1.3% of a batch, so I left it out. The tokeniser was the largest stage on the list.
What changes in
internal/content/scanner.go:Nextclasses bytes with a table of its own: the classes of packagesyntax, with the comment sign and the bytes that start a number kept apart.Nextreads numbers, the most common operand, itself, and puts each on the operand stack where it's made. Before, numbers went throughoperand, and the 40-byte result was copied twice.TJread their numbers the same way. Every other operand is read as before.Results:
BenchmarkScanner: 47.6 M → 37.9 M instructions (−20%), 2.15 → 1.35 ms.Same output:
Differential tests.
TestSameAsBeforeand the newFuzzSameAsBeforecompareNextwith the reader as it was, kept in the test asnextRef. They check every operator, operand, array element, inline image and counter, with the page whole and split over two streams.Corpus. The JSON output, warnings included, has the same SHA-256 as on main for all 3,253 files of the corpus cache (public corpus, pdf.js, PDFium, the six soak sets) and the fixtures.
Fuzzing with
-fuzzminimizetime 0s, nothing found:FuzzSameAsBeforeFuzzScannerFuzzExtractFuzzOpenFuzzPageThe new target is listed in
.github/fuzz-targets.txt, and the full test suite passes.Not done: going further would mean changing what an operand is (offsets instead of a byte slice), which touches every use in the interpreter, for perhaps 1–2% more.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DzYLyEzLqkwuqPQ9LXgMpD