Repository navigation
perf: shape per-table hook rows beside their insert - #1536
Merged
Merged
Conversation
Shapes each chunk on its own thread, settles early tables' file lists on the grouping thread, and defers the scan's ScannedFile copy there too.
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.
Refs #1534
Takes single-threaded work off the critical path of a config-table build whose per-table hook starts during the walk:
stream_table_rowsshapes each chunk of hook rows on its own thread (db::shape_json_rows, split out ofDb::shape_rows). Shaping one chunk now overlaps inserting the previous one.split_streamed). The batches loop no longer walks those files after the inserts.Found) into aScannedFile. The grouping thread makes the copy (Scanned::into_files).Db::get_table_columnsquotes the table name. The new code reads columns before any rows arrive, which broke a table namedorderthat matched no files.Avoids
tree_walk.rs,scanner.rsandlisting.rs(#1521, #1528).Measurements
Corpus: 131072 notes. Paired, alternating runs; medians. The machine was shared, load 18-30.
fd+xargs -P(fastest native), main / this PR, 31 pairsfrontmatter_parse_speed_test, fastest (15 pairs)The goal (at most 1.0x the fastest native) is not met, so the test stays on the
find+awkbar (it passes at 0.18). Timing a build of this PR on top of #1521 (131k files, ~125ms total):What is left needs the walk files (#1521's sys CPU cut, then more) plus a way around the ~20ms SQLite GROUP BY, which the natives do not pay.
Changelog / Migrations
packages/rust/changelog.d/packages/rust/migrations.d/E2E Verification
cargo test --workspace --features cli, 2068 passed)packages/python/e2e-attestations/bot-1534-fm-native-1016.jsonreceipt writtenpackages/ts/e2e-attestations/bot-1534-fm-native-1016.jsonreceipt writtentesting-conventions e2e attest 'uv run python -m pytest tests/e2e/frontmatter_parse_speed_test.py tests/e2e/jsonl_parse_speed_test.py tests/e2e/on_file_query_test.py tests/e2e/fanout_test.py tests/e2e/declared_table_name_test.py tests/e2e/query_contract_test.py tests/e2e/use_case_notebook_test.py tests/e2e/use_case_transcripts_test.py tests/e2e/sigint_interrupt_test.py -q -s';just e2e-attest-ts;cargo test --workspace --features cli