Repository navigation
The one-line SQL comment split test checks a linear ratio, so a newline scan to the end of the text fails it - #335
Merged
Merged
Conversation
…ne scan to the end of the text fails it With a newline search from each ';' not stopped at the next token, the 100,000-statement split still ran under the fixed 10 s bound (the scan runs in C), so the test named for bounded time passed on a quadratic split. It now times 10,000 and 160,000 statements, tracer off, and asserts the larger costs under 24 times the smaller: a linear split costs about 17, that regression about 50. _cpu is the timing _within uses. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
fix/sql-split-scaling-test
branch
from
November 7, 2026 08:49
545f789 to
9e94f34
Compare
…tracer Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… names the collector Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
...
Why
test_one_line_sql_with_a_comment_after_every_semicolon_splits_in_bounded_timeexists to catch a split ofSELECT 1; /* c */ …on one line that turns quadratic, and it cannot. Its likeliest regression is dropping thenext_startlimit fromtext.find("\n", end, next_start)inextractor/loom_extractor/sql.py, which makes every;scan to the end of the text. On a one-line script that changes no output, so only time shows it, and the scan runs in C: at 100,000 statements the split still ends within the fixed 10 s bound. With that line changed, the test passes onmain.The test now times 10,000 and 160,000 statements with the tracer off and asserts the larger costs under 24 times the smaller, plus 50 ms for timer noise. A linear split costs about 17 times here; the regression above costs about 50. A warm-up call keeps the sqlglot and dialect import out of the small timing.
_cpuis the tracer-off timing_withinalready used (from #297), so both share it, and it now also runsgc.collect()and keeps the garbage collector off while it times: a full collection walks every earlier test's heap in the worker and would land on one side of the ratio only.Scope and risk
One unit test, plus
_withinsplit into_cpuand the bound check. Every_withincaller (the hostile Markdown, TOML, HTML and SQL inputs) now times with the collector off as well; all pass.test_many_sql_statements_on_one_line_split_in_bounded_timekeeps its fixed bound: its input has no comments, so the boundedfinds never run for it.Compatibility, rollout and rollback
Tests
--cov=extractor; the_withincallers pass too (-k "linear_time or bounded_time": 6 passed).next_startdropped from the;line's newline search, it fails in both modes at this head:assert 8.01 < 24 * 0.139 + 0.05and, under coverage,assert 10.09 < 24 * 0.269 + 0.05.main's version of the test passes with the same change.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code; the probe and the timings were run by hand.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited.frontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code