Repository navigation
perf: read a plain path-table projection without stepping SQLite - #1537
Merged
Merged
Conversation
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.
Fixes #1475
A plain projection of one path table (
SELECT path FROM './a/b/**/*.md', any stat columns, aliases,SELECT *) now reads its rows straight from the statement's row cache instead of stepping SQLite once per row. The query is recognized by itsEXPLAINprogram: only the exact program SQLite compiles for a bare virtual-table scan qualifies. Anything else, includingWHERE,ORDER BY,LIMIT,DISTINCT, expressions, joins, CTEs or thecontentcolumn, still steps SQLite. Output is byte-identical: 18 queries were md5-compared against main, and a new integration test checks the rows read directly against the rows SQLite steps.The red commit raises the
./a/b/**/*.mdspeed case's bar from find to the fastest native (fd), matching./**/*.md.Ratios (paired median, dirsql / fd)
./a/b/**/*.md(800k-file tree, 41 rounds)./a/b/**/*.md(2M-item tree, 31 rounds)./**/*.md./**/*.js(no matches)E2E Verification
Red on main core:
uv run python -m pytest tests/e2e/glob_speed_recursive_test.pyfailed with prefix case median 1.731 vs fd.With the fix: the prefix case passed at median 1.009 (load 6). It failed at 1.23 under load 22, so it is load-sensitive.
Receipt (python):
uv run python -m pytest tests/e2e/{query_contract,declared_table_name,on_file_query,use_case_dossier,use_case_join,use_case_notebook,use_case_transcripts,stat_speed,glob_speed_one_level,glob_speed_recursive}_test.py -x -q: 23 passed.Receipt (ts):
pnpm test:e2e: pass.cargo test --workspace --features cli: pass.path_table_parallel_scanfailed once under load (timing assertion, count(*) query, not this path); it passed on rerun.Re-run after merging main (refactor: read a directory's listing in chunks #1528, fix: run config tables' on-file commands in declaration order #1539, A refresh updates a keyed row in place #1542, Check foreign keys once per build and per watch batch #1543), on c7452a0: receipt (python) the 13 glob-speed/query-contract/fanout/use-case-join/stat/release-speed e2e files, 32 passed. Fastest vs fd medians:
./a/b/**/*.md0.972,./**/*.md0.589. Receipt (ts)pnpm test:e2e: pass.cargo test --workspace --features cli: pass.Hand check, 800k tree, 30 interleaved pairs vs fd:
./a/b/**/*.md0.894,./**/*.md0.592.Changelog / Migrations
packages/rust/changelog.d/for each changed packagepackages/rust/migrations.d/for each changed package