Skip to content

Refactor validity checks to require explicit ExecutionCtx#8273

Open
joseph-isaacs wants to merge 4 commits into
developfrom
claude/eager-cerf-Sj3pp
Open

Refactor validity checks to require explicit ExecutionCtx#8273
joseph-isaacs wants to merge 4 commits into
developfrom
claude/eager-cerf-Sj3pp

Conversation

@joseph-isaacs
Copy link
Copy Markdown
Contributor

@joseph-isaacs joseph-isaacs commented Jun 5, 2026

Summary

This PR refactors the Validity API to require an explicit ExecutionCtx parameter for validity checks, improving execution context management and making it explicit where execution happens.

Changes

  1. New execution-aware methods in Validity:

    • Added execute_is_valid(index, ctx) - checks if an element is valid using the provided context
    • Added execute_is_null(index, ctx) - checks if an element is null using the provided context
  2. Deprecated legacy methods:

    • Marked is_valid(index) as deprecated in favor of execute_is_valid
    • Marked is_null(index) as deprecated in favor of execute_is_null
    • Legacy methods now delegate to the new execution-aware versions using LEGACY_SESSION

claude added 2 commits June 5, 2026 15:35
`Validity::is_valid`/`is_null` previously created an internal
`LEGACY_SESSION` execution context to evaluate the validity array.
Replace them with `execute_is_valid`/`execute_is_null` that accept an
`&mut ExecutionCtx` from the caller, threading the context through
where one is available and falling back to a `LEGACY_SESSION` context
only at boundaries that do not yet have one.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Keep the original ctx-free `is_valid`/`is_null` methods for backward
compatibility, marked `#[deprecated]`, delegating to the new
`execute_is_valid`/`execute_is_null` via a `LEGACY_SESSION` context.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
@joseph-isaacs joseph-isaacs added the changelog/deprecation A change that introduces a series of API deprecations label Jun 5, 2026 — with Claude
@joseph-isaacs joseph-isaacs marked this pull request as ready for review June 5, 2026 16:13
@joseph-isaacs joseph-isaacs requested a review from a team June 5, 2026 16:13
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 5, 2026

Merging this PR will improve performance by 18.36%

⚠️ 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.

⚡ 8 improved benchmarks
✅ 1505 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation bitwise_not_vortex_buffer_mut[128] 275.3 ns 216.9 ns +26.89%
Simulation rebuild_naive 141.9 µs 113.7 µs +24.84%
Simulation bitwise_not_vortex_buffer_mut[1024] 336.9 ns 278.6 ns +20.94%
Simulation extend_from_array_non_zctl_overlapping[(10000, 8)] 4.7 ms 4 ms +18.44%
Simulation bitwise_not_vortex_buffer_mut[2048] 400.6 ns 342.2 ns +17.05%
Simulation extend_from_array_non_zctl_overlapping[(1000, 8)] 527.8 µs 453.8 µs +16.3%
Simulation extend_from_array_zctl[(10000, 8)] 2.5 ms 2.2 ms +12.73%
Simulation extend_from_array_zctl[(1000, 8)] 290.9 µs 263 µs +10.61%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/eager-cerf-Sj3pp (dbb16c1) with develop (e06d80b)

Open in CodSpeed

@joseph-isaacs joseph-isaacs enabled auto-merge (squash) June 5, 2026 16:13
claude added 2 commits June 5, 2026 16:20
Consolidate the validity/scalar checks in the tests updated by the
`execute_is_valid` migration so each test creates one execution context
and reuses it, instead of constructing a fresh `LEGACY_SESSION` context
per call (some inside loops). Also unify the ALP sliced-vector test on a
single `SESSION` context for both encode and execute, rather than mixing
`SESSION` and `LEGACY_SESSION`.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
…ation

`VarBinViewArray`/`VarBinArray` validation only needs an execution context
when validity is array-backed. Previously `is_null` short-circuited for the
`NonNullable`/`AllValid` variants without ever creating a context, but the
ctx-threaded version constructed a `LEGACY_SESSION` context unconditionally,
adding overhead to the common non-null construction path (observed as a
regression in the `varbinview_zip` benchmarks).

Construct the context lazily, only for `Validity::Array`, and resolve the
constant variants without one. The UTF-8 validation loop is extracted into
`VarBinArray::validate_utf8` with an `is_null_at` helper to keep the
function within the cognitive-complexity budget.

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/deprecation A change that introduces a series of API deprecations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants