Reduce allocations when binding scalar parameters#344
Open
skuirrels wants to merge 1 commit into
Open
Conversation
skuirrels
marked this pull request as ready for review
July 21, 2026 09:22
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #344 +/- ##
===========================================
- Coverage 87.59% 86.67% -0.92%
===========================================
Files 77 77
Lines 3143 3264 +121
Branches 466 482 +16
===========================================
+ Hits 2753 2829 +76
- Misses 276 310 +34
- Partials 114 125 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
Scalar parameters currently create a temporary
duckdb_value, bind it, and dispose it on every execution. That adds wrapper overhead for common values such as numbers, strings, dates, and blobs.Solution
Use DuckDB's type-specific native bind functions for scalar values. Collections and types that need an exact logical representation keep the existing
duckdb_valuefallback.byte[]continues to bind as a collection for LIST/ARRAY targets and as BLOB otherwise.Benchmark
.NET 10 Release, 5 warmups, 10 measured iterations, three scalar parameters:
The stable result is 120 fewer managed bytes per execution; timing is naturally noisier.
Tests
develop-based branchbyte[]LIST and fixed ARRAY regression coverage