GeezerVison is showing github.com — sqlite: use shared-shape objects for result rows by araujogui · Pull Request #66385 · nodejs/node
Conversation
all(), get() and iterate() built each row with the Object::New() overload that takes names and values. That overload always returns a dictionary-mode object, so no two rows shared a map and every property read was a hash lookup.
Rows are now built from a DictionaryTemplate cached on the statement and invalidated on re-prepare. Rows keep their null prototype. Statements whose column names a template can't express (array indices, duplicates, non-ASCII names, which the template interns as Latin-1) or with more than 64 columns keep the previous path.
Adds benchmark/sqlite/sqlite-prepare-select-read.js, which reads every column of each row, since the existing benchmarks only measure building rows.
Fixes: #65799
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Review requested:
- @nodejs/performance
- @nodejs/sqlite
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
codecov
Bot
commented
Sep 29, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
❌ Patch coverage is 85.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.46%. Comparing base (9746ebc) to head (46793f9).
⚠️ Report is 135 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #66385 +/- ##
==========================================
+ Coverage 90.40% 90.46% +0.06%
==========================================
Files 791 791
Lines 276120 276682 +562
Branches 53022 53412 +390
==========================================
+ Hits 249618 250314 +696
+ Misses 16897 16768 -129
+ Partials 9605 9600 -5
... and 38 files with indirect coverage changes
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@araujogui Can you run the benchmark CI and post output here?
CI currently fails on summarizing the output. You can copy the raw output and summarize it locally.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
`all()`, `get()` and `iterate()` built each row with the
`Object::New()` overload that takes names and values. That overload
always returns a dictionary-mode object, so no two rows shared a map
and every property read was a hash lookup.
Build rows from a `DictionaryTemplate` cached on the statement in place
of the column names, invalidated on re-prepare. Rows keep their null
prototype. Statements whose column names a template cannot express
(array indices, duplicates, non-ASCII names, which the template
interns as Latin-1) or with more than 64 columns keep the previous
path.
Add a benchmark that reads every column of each row, since the
existing ones only measure building rows.
Fixes: nodejs#65799
Assisted-by: Claude
Signed-off-by: Guilherme Araújo <[email protected]>
|
Ops, closed PR by accident 😬
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
araujogui
commented
Oct 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Benchmarks:
sqlite-prepare-select-read
./node-master benchmark/compare.js --set CPUSET=0-11 --analyze --old ./node-master --new ./node-pr --filter sqlite-prepare-select-read -- sqlite
confidence improvement accuracy (*) (**) (***)
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='all' rows=1 n=10000 -1.52 % ±3.77% ±5.02% ±6.54%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='all' rows=1 n=10000 +3.31 % ±9.39% ±12.50% ±16.28%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='iterate' rows=1 n=10000 *** +16.64 % ±3.50% ±4.68% ±6.11%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='iterate' rows=1 n=10000 -0.32 % ±3.87% ±5.15% ±6.71%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='get' rows=1 n=10000 * +8.40 % ±7.46% ±9.92% ±12.91%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='get' rows=1 n=10000 -4.07 % ±8.53% ±11.35% ±14.77%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='all' rows=100 n=10000 *** +22.85 % ±0.46% ±0.61% ±0.79%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='all' rows=100 n=10000 -0.59 % ±0.90% ±1.20% ±1.56%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='iterate' rows=100 n=10000 *** +32.78 % ±0.52% ±0.69% ±0.91%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='iterate' rows=100 n=10000 *** -1.43 % ±0.75% ±1.00% ±1.31%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='get' rows=100 n=10000 *** +12.76 % ±6.27% ±8.34% ±10.87%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='get' rows=100 n=10000 +0.06 % ±11.41% ±15.18% ±19.76%
-33.3% 0% +33.3%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='all' rows=1 n=10000 ░░▓| -1.52%
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='all' rows=1 n=10000 ░░░░|▓░░░░░░ +3.31%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='iterate' rows=1 n=10000 |█████████░░ +16.64% ***
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='iterate' rows=1 n=10000 ░░░|░ -0.32%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='get' rows=1 n=10000 |████░░░░░ +8.40% *
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='get' rows=1 n=10000 ░░░░░░▓▓|░░ -4.07%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='all' rows=100 n=10000 |█████████████ +22.85% ***
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='all' rows=100 n=10000 ░| -0.59%
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='iterate' rows=100 n=10000 |███████████████████ +32.78% ***
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='iterate' rows=100 n=10000 █| -1.43% ***
sqlite/sqlite-prepare-select-read.js returnArrays=0 method='get' rows=100 n=10000 |███████░░░ +12.76% ***
sqlite/sqlite-prepare-select-read.js returnArrays=1 method='get' rows=100 n=10000 ░░░░░░░|░░░░░░ +0.06%
Rates were scaled by 1000x into HdrHistogram (3 significant figures).
Use --scale to adjust precision if needed.
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 12 comparisons, you can thus
expect the following amount of false-positive results:
0.60 false positives, when considering a 5% risk acceptance (*, **, ***),
0.12 false positives, when considering a 1% risk acceptance (**, ***),
0.01 false positives, when considering a 0.1% risk acceptance (***)
The stars above are per-benchmark and uncorrected. Adjusting for the size of
this comparison set (Holm-Bonferroni), 5 comparisons remain significant at 5%.
sqlite-prepare-select-all
./node-master benchmark/compare.js --set CPUSET=0-11 --analyze --old ./node-master --new ./node-pr --filter sqlite-prepare-select-all -- sqlite
confidence improvement accuracy (*) (**) (***)
sqlite/sqlite-prepare-select-all-options.js options='none' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -2.37 % ±0.69% ±0.92% ±1.20%
sqlite/sqlite-prepare-select-all-options.js options='readBigInts' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -1.82 % ±0.81% ±1.08% ±1.41%
sqlite/sqlite-prepare-select-all-options.js options='returnArrays' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -1.74 % ±0.62% ±0.82% ±1.07%
sqlite/sqlite-prepare-select-all-options.js options='readBigInts|returnArrays' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -1.29 % ±0.68% ±0.91% ±1.19%
sqlite/sqlite-prepare-select-all-options.js options='none' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -2.47 % ±0.40% ±0.53% ±0.71%
sqlite/sqlite-prepare-select-all-options.js options='readBigInts' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -1.80 % ±0.73% ±0.98% ±1.27%
sqlite/sqlite-prepare-select-all-options.js options='returnArrays' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 * -0.87 % ±0.82% ±1.08% ±1.41%
sqlite/sqlite-prepare-select-all-options.js options='readBigInts|returnArrays' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 -0.09 % ±0.74% ±0.99% ±1.29%
sqlite/sqlite-prepare-select-all.js statement='SELECT 1' tableSeedSize=100000 n=100000 *** -3.93 % ±1.41% ±1.88% ±2.45%
sqlite/sqlite-prepare-select-all.js statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -2.49 % ±0.71% ±0.95% ±1.24%
sqlite/sqlite-prepare-select-all.js statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -2.81 % ±0.42% ±0.56% ±0.75%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 +0.05 % ±1.15% ±1.55% ±2.04%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -15.69 % ±0.26% ±0.34% ±0.46%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -1.48 % ±0.78% ±1.04% ±1.38%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -15.68 % ±0.34% ±0.45% ±0.60%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -5.18 % ±0.94% ±1.26% ±1.67%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -16.99 % ±0.34% ±0.45% ±0.59%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column, blob_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 *** -2.18 % ±0.75% ±1.00% ±1.30%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column, blob_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 *** -2.96 % ±0.58% ±0.77% ±1.00%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_8kb_column FROM foo_large LIMIT 1' tableSeedSize=100000 n=100000 -0.35 % ±2.33% ±3.11% ±4.04%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_8kb_column FROM foo_large LIMIT 100' tableSeedSize=100000 n=100000 *** -0.52 % ±0.28% ±0.38% ±0.50%
-17.3% 0% +17.3%
sqlite/sqlite-prepare-select-all-options.js options='none' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░███| -2.37% ***
sqlite/sqlite-prepare-select-all-options.js options='readBigInts' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░██| -1.82% ***
sqlite/sqlite-prepare-select-all-options.js options='returnArrays' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░██| -1.74% ***
sqlite/sqlite-prepare-select-all-options.js options='readBigInts|returnArrays' statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░█| -1.29% ***
sqlite/sqlite-prepare-select-all-options.js options='none' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ███| -2.47% ***
sqlite/sqlite-prepare-select-all-options.js options='readBigInts' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ░██| -1.80% ***
sqlite/sqlite-prepare-select-all-options.js options='returnArrays' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ░█| -0.87% *
sqlite/sqlite-prepare-select-all-options.js options='readBigInts|returnArrays' statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ░| -0.09%
sqlite/sqlite-prepare-select-all.js statement='SELECT 1' tableSeedSize=100000 n=100000 ░█████| -3.93% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT * FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░███| -2.49% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT * FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ░███| -2.81% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░| +0.05%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ██████████████████| -15.69% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░██| -1.48% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ██████████████████| -15.68% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ░██████| -5.18% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ████████████████████| -16.99% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column, blob_column FROM foo LIMIT 1' tableSeedSize=100000 n=100000 ███| -2.18% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_column, integer_column, real_column, blob_column FROM foo LIMIT 100' tableSeedSize=100000 n=100000 ░███| -2.96% ***
sqlite/sqlite-prepare-select-all.js statement='SELECT text_8kb_column FROM foo_large LIMIT 1' tableSeedSize=100000 n=100000 ░░░|░ -0.35%
sqlite/sqlite-prepare-select-all.js statement='SELECT text_8kb_column FROM foo_large LIMIT 100' tableSeedSize=100000 n=100000 █| -0.52% ***
Rates were scaled by 1000x into HdrHistogram (3 significant figures).
Use --scale to adjust precision if needed.
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 21 comparisons, you can thus
expect the following amount of false-positive results:
1.05 false positives, when considering a 5% risk acceptance (*, **, ***),
0.21 false positives, when considering a 1% risk acceptance (**, ***),
0.02 false positives, when considering a 0.1% risk acceptance (***)
The stars above are per-benchmark and uncorrected. Adjusting for the size of
this comparison set (Holm-Bonferroni), 17 comparisons remain significant at 5%.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
trivikr
added
request-ci
Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review.
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
labels
Oct 13, 2026
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
aduh95
pushed a commit
that referenced
this pull request
Nov 12, 2026
`all()`, `get()` and `iterate()` built each row with the
`Object::New()` overload that takes names and values. That overload
always returns a dictionary-mode object, so no two rows shared a map
and every property read was a hash lookup.
Build rows from a `DictionaryTemplate` cached on the statement in place
of the column names, invalidated on re-prepare. Rows keep their null
prototype. Statements whose column names a template cannot express
(array indices, duplicates, non-ASCII names, which the template
interns as Latin-1) or with more than 64 columns keep the previous
path.
Add a benchmark that reads every column of each row, since the
existing ones only measure building rows.
Fixes: #65799
Assisted-by: Claude
Signed-off-by: Guilherme Araújo <[email protected]>
PR-URL: #66385
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
gabylb
pushed a commit
to gabylb/node
that referenced
this pull request
Nov 27, 2026
`all()`, `get()` and `iterate()` built each row with the
`Object::New()` overload that takes names and values. That overload
always returns a dictionary-mode object, so no two rows shared a map
and every property read was a hash lookup.
Build rows from a `DictionaryTemplate` cached on the statement in place
of the column names, invalidated on re-prepare. Rows keep their null
prototype. Statements whose column names a template cannot express
(array indices, duplicates, non-ASCII names, which the template
interns as Latin-1) or with more than 64 columns keep the previous
path.
Add a benchmark that reads every column of each row, since the
existing ones only measure building rows.
Fixes: nodejs#65799
Assisted-by: Claude
Signed-off-by: Guilherme Araújo <[email protected]>
PR-URL: nodejs#66385
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
c++
Issues and PRs that require attention from people who are familiar with C++.
needs-benchmark-ci
PRs that need a benchmark CI run.
needs-ci
PRs that need a full CI run.
sqlite
Issues and PRs related to the SQLite subsystem.
Milestone
No milestone
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.
|