Skip to content

Keep only text and BLOB values in a statement's bound parameters - #393

Merged
quinnj-bot[bot] merged 1 commit into
masterfrom
claude/bind-isbits-params
Nov 19, 2026
Merged

quinnj-bot[bot] merged 1 commit into
masterfrom
claude/bind-isbits-params

Conversation

@quinnj-bot

@quinnj-bot quinnj-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

Every bind! call stored its value in stmt.params, a Dict{Int,Any} that keeps bound values alive while SQLite reads them. SQLite copies numbers and NULLs when they are bound, so for those values the store only boxed the value and hashed it into the Dict. That cost lands on every value in load!, execute, and executemany.

What changed

  • bind! no longer stores numbers, Bool, missing, or nothing in stmt.params. Text and BLOB values, which SQLite reads in place, are still stored.

Scope

  • Parameter binding only. No change to what SQLite receives.

Blast Radius

Every bound parameter. When a parameter that held text is rebound to a number, stmt.params keeps the old text until that parameter gets text or a BLOB again, clear! runs, or the statement is freed. Before, the number replaced it. At most one stale value per parameter stays alive.

Verification

  • load! of a mixed 10-column table with 1M rows went from 658 ms to 561 ms (2237 to 1972 million cycles). executemany of the same rows went from 2670 ms to 2458 ms. A prepared one-row query on an in-memory database used 6% fewer cycles (404 to 380 million per 100k queries). Each number is the median of 7 fresh-process runs per side, interleaved with master, on a shared 14-core Apple silicon machine (load average 10 to 50).
  • No other case is slower at rank-sum p < 0.01.
  • Pkg.test() passes on Julia 1.12 and 1.10, and the trim workload (test/trim) builds and runs on Julia 1.13.

🤖 Generated with Claude Code

`bind!` stored every bound value in `stmt.params`, a `Dict{Int,Any}`
that keeps values alive while SQLite reads them. SQLite copies numbers
and NULLs when they are bound, so storing them only boxed each value and
hashed it into the Dict, once per value in every `load!`, `execute`, and
`executemany` call.

Numeric, Bool, `missing`, and `nothing` values are no longer stored.
Text and BLOB values, which SQLite reads in place, still are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.28%. Comparing base (511b83a) to head (0583356).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #393      +/-   ##
==========================================
- Coverage   97.30%   97.28%   -0.02%     
==========================================
  Files           5        5              
  Lines         854      848       -6     
==========================================
- Hits          831      825       -6     
  Misses         23       23              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quinnj-bot
quinnj-bot Bot merged commit 7e075de into master Nov 19, 2026
9 checks passed
@quinnj-bot
quinnj-bot Bot deleted the claude/bind-isbits-params branch November 19, 2026 20:29
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