Skip to content

perf(executor): per-ExecutionCtx ArrayKernels snapshot#63

Closed
lukekim wants to merge 1 commit into
developfrom
lukim/exec-kernel-snapshot-develop
Closed

perf(executor): per-ExecutionCtx ArrayKernels snapshot#63
lukekim wants to merge 1 commit into
developfrom
lukim/exec-kernel-snapshot-develop

Conversation

@lukekim

@lukekim lukekim commented Jun 12, 2026

Copy link
Copy Markdown

What

Resolves ArrayKernels once at ExecutionCtx construction into a crate-private KernelSnapshot (a single ArcSwapMap::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 execution paths.

Why

  • Removes a per-array-node session clone + DashMap shard RwLock probe from the hot execution loop.
  • Stops holding the session-variable read guard across kernel invocation (previously a plugin kernel touching the session registry could contend/deadlock on the same shard).

Semantics

The registry is session-scoped and mutable via its public register_* methods. An ExecutionCtx sees a point-in-time snapshot taken at construction; later registrations are picked up by the next context (contexts are created per evaluation). Kernel lookup order is unchanged: registered plugin kernels are tried before static execute_parent kernels, with the same (parent, child) hashing.

Adds a pub(crate) ArcSwapMap::load_full accessor (snapshot-that-outlives-the-call, complementing read). KernelSnapshot and ArrayKernels::snapshot() are pub(crate) — no new public API.

Testing

  • cargo nextest run -p vortex-array — 2893 passed (includes struct_cast_execute_parent_uses_session_plugin, covering the register → snapshot → execute path).
  • cargo clippy --all-targets -p vortex-array — clean on the spiceai-53 variant of this change; develop port re-verified via the full test build.

Develop-targeting twin of #61 (same change, adapted to the ArcSwapMap refactor on develop).

Resolve ArrayKernels once at ExecutionCtx construction into a KernelSnapshot
(an ArcSwapMap::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). Adds a pub(crate) ArcSwapMap::load_full accessor; the
KernelSnapshot type and ArrayKernels::snapshot() are pub(crate), so no new
public API is added.

Signed-off-by: Luke Kim <80174+lukekim@users.noreply.github.com>
@lukekim lukekim added the changelog/performance A performance improvement label Jun 12, 2026
@lukekim lukekim closed this Jun 12, 2026
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.

1 participant