Skip to content

feat(hotpath): fill rusqlite-runtime execute/query gaps - #778

Draft
ScriptedAlchemy wants to merge 4 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
cursor/hotpath-gap-fill-8c00
Draft

feat(hotpath): fill rusqlite-runtime execute/query gaps#778
ScriptedAlchemy wants to merge 4 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
cursor/hotpath-gap-fill-8c00

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Gap-fill hotpath instrumentation PR for crates/tracedecay-rusqlite-runtime only (HP-db-sqlite), stacked on #707. Adds 56 new #[hotpath::measure] sites on previously unmeasured SQL execution, transaction, reader-lease, and recovery-authority paths. No existing measure site was renamed, moved, or rewritten; the diff is insertions only (56 added lines, 0 removed).

  • All new labels follow the crate.area.verb grammar (rusqlite.<area>.<verb>).
  • No Cargo.toml changes: the crate already has the hotpath / hotpath-alloc / hotpath-cpu feature passthrough, and these features remain excluded from default and production. Without --features hotpath every macro expands to a no-op.
  • No tests/benches/CI changes (separate coverage PR).
  • Compile-verified: cargo check -p tracedecay-rusqlite-runtime (default) and cargo check -p tracedecay-rusqlite-runtime --features hotpath both pass, plus cargo clippy -p tracedecay-rusqlite-runtime --all-targets --features hotpath is clean. Commit subject passes lint:commit.

Files touched / new measure sites / new labels

File New sites New labels
src/repository/project.rs 7 rusqlite.project.fact_write, rusqlite.project.observation_write, rusqlite.project.observation_batch, rusqlite.project.remote_observation_replay, rusqlite.project.observation_cursor_advance, rusqlite.project.evidence_assembly_write, rusqlite.project.read
src/repository/diagnostics.rs 5 rusqlite.diagnostics.write, rusqlite.diagnostics.supersede, rusqlite.diagnostics.read, rusqlite.diagnostics.chain_walk, rusqlite.diagnostics.insert_record
src/repository/retrieval_anchor.rs 4 rusqlite.retrieval_anchor.disposition_write, rusqlite.retrieval_anchor.derivative_write, rusqlite.retrieval_anchor.read, rusqlite.retrieval_anchor.current_record
src/repository/configuration.rs 3 rusqlite.configuration.write, rusqlite.configuration.read, rusqlite.configuration.insert_revision
src/repository/remote.rs 3 rusqlite.remote.fence_verify_seed, rusqlite.remote.observation_event_persist, rusqlite.remote.fence_install
src/remote/recovery_authority.rs 10 rusqlite.recovery.publish_authority, rusqlite.recovery.reconcile_promotions, rusqlite.recovery.seed_authority, rusqlite.recovery.promotion_pending, rusqlite.recovery.execute_operation, rusqlite.recovery.load_writer, rusqlite.recovery.load_writer_lineage, rusqlite.recovery.promote, rusqlite.recovery.authority_state, rusqlite.recovery.persist_sink_receipts
src/reader/pool/lease.rs 8 rusqlite.reader_lease.begin_snapshot, rusqlite.reader_lease.execute, rusqlite.reader_lease.exact_sql_query, rusqlite.reader_lease.begin_exact_sql_snapshot, rusqlite.reader_lease.exact_sql_snapshot_query, rusqlite.reader_lease.store_size, rusqlite.reader_lease.table_sizes, rusqlite.reader_lease.finish_snapshot
src/reader/pool/mod.rs 3 rusqlite.reader_pool.release_memory, rusqlite.reader_pool.retire_idle, rusqlite.reader_pool.add_worker
src/exact_sql/mod.rs 9 rusqlite.exact_sql.checkpoint_wal_truncate, rusqlite.exact_sql.release_memory, rusqlite.exact_sql.repair_auto_vacuum, rusqlite.exact_sql.txn_commit, rusqlite.exact_sql.txn_rollback, rusqlite.exact_sql.txn_dispatch, rusqlite.exact_sql.attach_db, rusqlite.exact_sql.detach_db, rusqlite.exact_sql.execute_batch
src/connection/mod.rs 1 rusqlite.connection.verify_identity
src/writer.rs 2 (async, future = true) rusqlite.writer.bounded_incremental_vacuum, rusqlite.writer.enqueue_online_backup
src/work/sql.rs 1 rusqlite.work.query

Placement notes for review

  • One measurement level per call chain. Leaf executors that already carry measures (external-source, graph-publication, attachment) did not get duplicate wrappers in ProjectExecutor; conversely ProjectExecutor covers the lanes whose leaf executors are unmeasured (fact, observation, evidence assembly). Diagnostics/retrieval-anchor/configuration lanes are measured at their leaf executor files instead of the project.rs wrappers.
  • Handle vs. worker spans. exact_sql transaction commit/rollback/dispatch and the writer's vacuum/backup enqueues are measured on the caller side; the existing worker-side spans (rusqlite.commit, rusqlite.exact_sql.vacuum, rusqlite.writer.online_backup) stay untouched, so the delta between the two populations exposes writer-actor queue wait, mirroring the existing begin_immediate / write_lock split documented in the code.
  • submit was left unmeasured because it delegates directly to the already-measured submit_authorized; snapshot_to / snapshot_to_interruptible are covered by the shared enqueue_online_backup span.
  • rusqlite.reader_lease.finish_snapshot covers the snapshot-end rollback wait including the deferred-return grace path.

Constraints honored

  • Only crates/tracedecay-rusqlite-runtime changed; no other crate or workspace Cargo.toml touched.
  • hotpath* features remain opt-in only (never in default/production).
  • Stacked on codex/tracedecay-total-redesign-plan-reopened; feat: consolidate TraceDecay V2 PR8-PR13 delivery #707 is not merged and master is not targeted.
Open in Web Open in Cursor 

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b87c34c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Performance Comparison codex/tracedecay-total-redesign-plan-reopenedcursor/hotpath-gap-fill-8c00

Total Elapsed Time: 5.17s → 5.70s (+10.3%)
CPU Baseline: 87.70µs → 79.48µs (-9.4%)
Benchmark ID: index-bench-timing

timing - Execution duration of functions.

+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| Function                                 | Calls                      | Avg                             | P95                             | Total                            | % Total                      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| tracedecay-index-bench                   | 1 → 1 (+0.0%)              | 5.17s → 5.70s (+10.3%)          | 5.17s → 5.70s (+10.3%)          | 5.17s → 5.70s (+10.3%)           | 100.00% → 100.00% (+0.0%)    |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.append_pages              | 13 → 13 (+0.0%)            | 181.50ms → 200.28ms (+10.3%)    | 247.86ms → 287.31ms (+15.9%)    | 2.36s → 2.60s (+10.2%)           | 45.66% → 45.69% (+0.1%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.workers.install               | 83 → 83 (+0.0%)            | 16.06ms → 20.62ms (+28.4%) ⚠️   | 53.61ms → 72.81ms (+35.8%) ⚠️   | 1.33s → 1.71s (+28.6%) ⚠️        | 25.80% → 30.03% (+16.4%)     |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.batch.sqlite              | 13 → 13 (+0.0%)            | 124.41ms → 129.68ms (+4.2%)     | 170.52ms → 185.34ms (+8.7%)     | 1.62s → 1.69s (+4.3%)            | 31.30% → 29.58% (-5.5%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.batch.postings            | 13 → 13 (+0.0%)            | 108.85ms → 112.99ms (+3.8%)     | 150.08ms → 164.76ms (+9.8%)     | 1.42s → 1.47s (+3.5%)            | 27.38% → 25.77% (-5.9%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| CodeIndexProductionOwnerV1::extract_file | 276 → 276 (+0.0%)          | 5.07ms → 5.26ms (+3.7%)         | 7.45ms → 9.67ms (+29.8%) ⚠️     | 1.40s → 1.45s (+3.6%)            | 27.07% → 25.47% (-5.9%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.build.and_publish             | 2 → 2 (+0.0%)              | 532.55ms → 621.35ms (+16.7%)    | 537.92ms → 635.96ms (+18.2%)    | 1.07s → 1.24s (+15.9%)           | 20.61% → 21.81% (+5.8%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| domain.canonical.sha256                  | 114526 → 114526 (+0.0%)    | 9.05µs → 10.43µs (+15.2%)       | 15.06µs → 15.14µs (+0.5%)       | 1.04s → 1.19s (+14.4%)           | 20.06% → 20.97% (+4.5%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.finalization.advance_wake | 14 → 14 (+0.0%)            | 55.49ms → 56.18ms (+1.2%)       | 282.59ms → 276.04ms (-2.3%)     | 776.81ms → 786.58ms (+1.3%)      | 15.03% → 13.80% (-8.2%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.prepare_pages             | 13 → 13 (+0.0%)            | 47.58ms → 60.49ms (+27.1%) ⚠️   | 68.55ms → 89.00ms (+29.8%) ⚠️   | 618.57ms → 786.38ms (+27.1%) ⚠️  | 11.97% → 13.80% (+15.3%)     |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.chunk.index_file              | 276 → 276 (+0.0%)          | 2.45ms → 2.46ms (+0.4%)         | 3.31ms → 4.19ms (+26.6%) ⚠️     | 675.04ms → 677.92ms (+0.4%)      | 13.06% → 11.90% (-8.9%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.batch.parallel_prepare    | 13 → 13 (+0.0%)            | 37.32ms → 50.09ms (+34.2%) ⚠️   | 53.61ms → 75.76ms (+41.3%) ⚠️   | 485.10ms → 651.12ms (+34.2%) ⚠️  | 9.39% → 11.43% (+21.7%) ⚠️   |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.extract.parser_artifact       | 276 → 276 (+0.0%)          | 2.08ms → 2.22ms (+6.7%)         | 3.20ms → 3.31ms (+3.4%)         | 574.92ms → 613.38ms (+6.7%)      | 11.13% → 10.76% (-3.3%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.build.assemble                | 2 → 2 (+0.0%)              | 193.77ms → 222.55ms (+14.9%)    | 205.78ms → 227.80ms (+10.7%)    | 387.53ms → 445.10ms (+14.9%)     | 7.50% → 7.81% (+4.1%)        |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| 🆕 code_index.chunk.build                | 0 → 276 (+100.0%) ⚠️       | 0.00ns → 1.55ms (+100.0%) ⚠️    | 0.00ns → 2.57ms (+100.0%) ⚠️    | 0.00ns → 426.55ms (+100.0%) ⚠️   | 0.00% → 7.48% (+100.0%) ⚠️   |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| 🗑️ code_index.chunk.map_ordered          | 780 → 0 (-100.0%) 🚀       | 515.64µs → 0.00ns (-100.0%) 🚀  | 598.53µs → 0.00ns (-100.0%) 🚀  | 402.20ms → 0.00ns (-100.0%) 🚀   | 7.78% → 0.00% (-100.0%) 🚀   |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+

Generated with hotpath-rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants