Skip to content

perf: cache static identifiers to avoid per-call interner locks#8614

Merged
robert3005 merged 1 commit into
vortex-data:developfrom
miniex:perf/cache-static-ids
Jun 29, 2026
Merged

perf: cache static identifiers to avoid per-call interner locks#8614
robert3005 merged 1 commit into
vortex-data:developfrom
miniex:perf/cache-static-ids

Conversation

@miniex

@miniex miniex commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

id() methods for encodings, scalar/aggregate functions, layouts and extension dtypes built their Id via Id::new/Id::new_static, which interns into a globally locked table (ThreadedRodeo) on every call. As noted in #8380 this made identifier construction a hot-path bottleneck under multi-threaded and random access. They now read a CachedId static that interns once on first access and returns the cached Id lock-free thereafter; the interned value is unchanged, so encoding and serialization behaviour is identical.

This is the migration half of #8380; the workspace clippy lint that forbids the locking constructors (so the regression can't return) follows in a separate PR.

Refs: #8380

Testing

cargo nextest run -p vortex-session -p vortex-array -p vortex-layout -p vortex-geo -p vortex-tensor -p vortex-json passes; cargo +nightly fmt --all --check and cargo clippy --all-targets clean. vortex-cuda could not be built locally (no CUDA toolchain); its one migrated id() uses the same pattern.


I'm Korean, so sorry if any wording reads a little awkward.

`id()` methods interned their `Id` via `Id::new`/`Id::new_static` on every
call, locking the global interner on hot paths. Use a `CachedId` static
that interns once and returns the cached `Id` lock-free; same value.

Refs: vortex-data#8380

Signed-off-by: Han Damin <miniex@daminstudio.net>
@codspeed-hq

codspeed-hq Bot commented Jun 29, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 10.1%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 6 improved benchmarks
❌ 3 regressed benchmarks
✅ 1586 untouched benchmarks
⏩ 4 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation chunked_varbinview_into_canonical[(1000, 10)] 169.1 µs 205.6 µs -17.73%
Simulation slice_empty_vortex 339.4 ns 397.8 ns -14.66%
Simulation compact_sliced[(4096, 90)] 750 ns 866.7 ns -13.46%
Simulation chunked_bool_canonical_into[(1000, 10)] 26.3 µs 16.7 µs +57.19%
Simulation bitwise_not_vortex_buffer_mut[128] 244.4 ns 186.1 ns +31.34%
Simulation bitwise_not_vortex_buffer_mut[1024] 304.7 ns 246.4 ns +23.68%
Simulation bitwise_not_vortex_buffer_mut[2048] 398.6 ns 340.3 ns +17.14%
Simulation chunked_varbinview_canonical_into[(100, 100)] 259.7 µs 224.3 µs +15.78%
Simulation chunked_varbinview_into_canonical[(100, 100)] 306.7 µs 271.5 µs +12.98%

Tip

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


Comparing miniex:perf/cache-static-ids (ab41b71) with develop (bf2be52)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@robert3005 robert3005 added the changelog/performance A performance improvement label Jun 29, 2026
@robert3005 robert3005 merged commit 733ab9e into vortex-data:develop Jun 29, 2026
80 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants