Skip to content

Combine row stepping and column collection - #1445

Draft
bradengroom wants to merge 2 commits into
mattn:masterfrom
bradengroom:codex/fuse-step-column-values
Draft

Combine row stepping and column collection#1445
bradengroom wants to merge 2 commits into
mattn:masterfrom
bradengroom:codex/fuse-step-column-values

Conversation

@bradengroom

@bradengroom bradengroom commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Depends on #1444. Incremental diff. I will rebase this once the dependency PR lands.

Summary

SQLiteRows.Next currently crosses cgo once to call sqlite3_step and, for every returned row, a second time to collect its column values. This PR combines both operations in one C helper.

It retains the same row buffer, conversions, error handling, and cancellation tracking; the helper collects values only when sqlite3_step returns SQLITE_ROW.

Benchmarks

Apple M4 Max, Go 1.26.5, 10 interleaved runs at 500 ms per benchmark. Medians were compared with benchstat; ~ means no statistically significant difference at p=0.05. Base is 840a3ec and this PR is 0869632.

Benchmark Base This PR Change
RowsContext/rows=1/context=non_cancelable 994 ns 981 ns -1.3%
RowsContext/rows=1/context=cancelable 1.146 µs 1.144 µs ~
RowsContext/rows=1000/context=non_cancelable 96.0 µs 77.7 µs -19.1%
RowsContext/rows=1000/context=cancelable 104.3 µs 85.2 µs -18.3%
BenchmarkSuite/BenchmarkQuery 1.854 µs 1.834 µs -1.1%
BenchmarkSuite/BenchmarkRows 52.0 µs 50.2 µs -3.5%
BenchmarkSuite/BenchmarkStmtRows 49.7 µs 47.2 µs -5.0%

Bytes and allocations per operation are unchanged in every measured benchmark.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 365135ec-849a-483f-a658-d1fead965893

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mattn

mattn commented Sep 5, 2026

Copy link
Copy Markdown
Owner

#1444 has been merged — thank you again! Feel free to rebase this one onto master and mark it ready for review; the incremental diff looked promising and I'll benchmark it the same way (please keep an eye out for regressions on the non-cancellable path when fusing step and column collection).

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.

2 participants