Skip to content

Optimize prepared scalar execution#5

Merged
skuirrels merged 1 commit into
release/fork-1.5.4from
feature/fork-1.5.4-performance-next
Jul 21, 2026
Merged

Optimize prepared scalar execution#5
skuirrels merged 1 commit into
release/fork-1.5.4from
feature/fork-1.5.4-performance-next

Conversation

@skuirrels

Copy link
Copy Markdown
Owner

Summary

  • add a direct ExecuteScalar fast path for reusable prepared statements
  • read and dispose only the first result vector instead of constructing a full DuckDBDataReader
  • retain the former reader path as a same-process benchmark comparison
  • cover values, SQL nulls, empty results, non-query statements, representative reader types, streaming mode, and reuse after materialization failure

Performance

The paired same-process benchmark measured the prepared scalar path at 22.95 us and 176 B versus 23.62 us and 944 B through the former reader path. That is approximately 2.8% lower mean time and 81.4% lower managed allocation, with Gen0 collections eliminated for the measured operation.

The exact-branch rerun was noisy under the active VM, so the reliable claim is the allocation reduction rather than a statistically significant latency improvement.

Validation

  • focused DuckDBCommandTests: 20 passed
  • full test suite: 7,012 passed, 0 failed
  • Release solution build: succeeded for net8.0 and net10.0
  • fork preview bindings and data packages: packed successfully
  • packaged preview smoke test: passed against DuckDB v1.5.4
  • git diff --check: clean

@skuirrels
skuirrels merged commit c9e2ae5 into release/fork-1.5.4 Jul 21, 2026
9 of 12 checks passed
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