perf(executor): per-ExecutionCtx ArrayKernels snapshot#61
Merged
Conversation
Resolve ArrayKernels once at ExecutionCtx construction into a KernelSnapshot (an ArcSwap::load_full of the execute-parent kernel map) instead of cloning the session and probing the sharded session-variable DashMap on every array node in the execute_until / single-step paths. This also stops holding the session-variable read guard across kernel invocation. The registry is session-scoped and mutable via its public register_* methods: an ExecutionCtx sees a point-in-time snapshot taken at construction, and later registrations are picked up by the next context (contexts are created per evaluation). KernelSnapshot and ArrayKernels::snapshot() are pub(crate), so no new public API is added. Signed-off-by: Luke Kim <80174+lukekim@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR optimizes the vortex-array execution hot path by taking a point-in-time snapshot of session-scoped ArrayKernels execute-parent registrations at ExecutionCtx construction, avoiding repeated session-variable lookups and lock probing during execute_until and single-step execution.
Changes:
- Added
ArrayKernels::snapshot()and a crate-privateKernelSnapshotto capture the current execute-parent kernel registry via a singleArcSwap::load_full(). - Cached
Option<KernelSnapshot>insideExecutionCtx, and updated execute-parent dispatch to consult the snapshot instead of re-reading from the session per array node. - Updated internal execute-parent helper signatures to accept
Option<&KernelSnapshot>.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
vortex-array/src/optimizer/kernels.rs |
Introduces KernelSnapshot and ArrayKernels::snapshot() to capture execute-parent kernels as an owned Arc without copying the map. |
vortex-array/src/executor.rs |
Caches the snapshot in ExecutionCtx and routes execute-parent plugin lookup through the cached snapshot to avoid repeated session probes/locks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 12, 2026
krinart
approved these changes
Jun 12, 2026
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.
What
Resolves
ArrayKernelsonce atExecutionCtxconstruction into a crate-privateKernelSnapshot(a singleArcSwap::load_fullof the execute-parent kernel map), instead of cloning the session and probing the sharded session-variableDashMapon every array node in theexecute_until/ single-step execution paths.Why
DashMapshardRwLockprobe from the hot execution loop.Semantics
The registry is session-scoped and mutable via its public
register_*methods. AnExecutionCtxsees a point-in-time snapshot taken at construction; later registrations are picked up by the next context (contexts are created per evaluation, e.g.create_execution_ctx()per filter/projection evaluation). Kernel lookup order is unchanged: registered plugin kernels are tried before staticexecute_parentkernels, with the same(parent, child)hashing.KernelSnapshotandArrayKernels::snapshot()arepub(crate)— no new public API.Testing
cargo nextest run -p vortex-array— 2789 passed (includesstruct_cast_execute_parent_uses_session_plugin, which registers a plugin kernel and then executes through a fresh ctx, covering the register → snapshot → execute path).cargo clippy --all-targets -p vortex-array— no diagnostics in changed files.Split out of #60 (first of two independent changes).