Repository navigation
perf(tools): count inline test modules in a read outline, don't list them - #463
Merged
Merged
Conversation
…them
A large Rust file read as an outline listed every declaration, and in a
file like session.rs most of them are test names. Declarations inside
an inline #[cfg(test)] mod { } are now counted in the header instead;
the mod line stays so a range read can still reach them.
bench_tokens.py: request 2 uncached 4,390 -> 2,629; session input
135,092 -> 120,950 (-10%).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Why
A large Rust file is read as an outline of its declarations. In
session.rsmost of those are test names (fn load_fills_missing_message_timestamp_from_valid_and_invalid_rows, …), which a read rarely needs.What
#[cfg(test)] mod … { }body are left out and counted in the header:# outline: N declarations (+M in test modules, not listed) of L lines.#[cfg(test)] mod tests {line stays, so the model can read the range if it needs a test.#[cfg(test)] mod x;and#[cfg(test)] fnare untouched. An unclosed module hides to end of file.Measured (release, Windows, o200k,
bench_tokens.py, vs main with #460/#461)Checks
cargo test -p whycodes-tools --lib file::(267 pass, new test covers closed / unclosed /mod x;/#[cfg(test)] fn)🤖 Generated with Claude Code