Skip to content

perf: defer database attachment for cached queries#1177

Draft
MichaReiser wants to merge 1 commit into
salsa-rs:masterfrom
MichaReiser:optimize-query-attachment
Draft

perf: defer database attachment for cached queries#1177
MichaReiser wants to merge 1 commit into
salsa-rs:masterfrom
MichaReiser:optimize-query-attachment

Conversation

@MichaReiser

@MichaReiser MichaReiser commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Defer database attachment until a tracked query takes a cold path, so cached top-level and nested queries avoid repeated TLS guard work.

Event callbacks, tracing, cancellation cleanup, and query execution still run with the database attached; mismatched databases continue to panic.

Testing: Passed the full test suite and all-features checks.

@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 57155d4
🔍 Latest deploy log https://app.netlify.com/projects/salsa-rs/deploys/6a3b732abcd26e0008a8d57e

@codspeed-hq

codspeed-hq Bot commented Jun 21, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 7.77%

❌ 1 regressed benchmark
✅ 7 untouched benchmarks
🗄️ 34 archived benchmarks run1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation many_tracked_structs 8.5 µs 9.2 µs -7.77%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing MichaReiser:optimize-query-attachment (57155d4) with master (dd0ae68)

Open in CodSpeed

Footnotes

  1. 34 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them.

@MichaReiser

Copy link
Copy Markdown
Contributor Author

huh

@MichaReiser MichaReiser force-pushed the optimize-query-attachment branch from 3ad7814 to 2f79db2 Compare June 21, 2026 12:25
@MichaReiser MichaReiser changed the title perf: skip redundant database attachment checks perf: defer database attachment for cached queries Jun 21, 2026
@MichaReiser MichaReiser force-pushed the optimize-query-attachment branch from b3b0f5a to f226c44 Compare June 22, 2026 09:22
@MichaReiser MichaReiser force-pushed the optimize-query-attachment branch from 2188fa7 to 4ef0944 Compare June 23, 2026 12:46
MichaReiser added a commit to astral-sh/ruff that referenced this pull request Jun 23, 2026
MichaReiser added a commit to astral-sh/ruff that referenced this pull request Jun 23, 2026
@MichaReiser MichaReiser changed the title perf: defer database attachment for cached queries perf: defer database.as_dyn_database call Jun 23, 2026
@MichaReiser MichaReiser marked this pull request as ready for review June 23, 2026 16:36
@MichaReiser MichaReiser marked this pull request as draft June 23, 2026 16:37
@MichaReiser MichaReiser force-pushed the optimize-query-attachment branch from 4ef0944 to 57155d4 Compare June 24, 2026 06:03
@MichaReiser MichaReiser changed the title perf: defer database.as_dyn_database call perf: defer database attachment for cached queries Jun 24, 2026
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.

1 participant