-
-
Notifications
You must be signed in to change notification settings - Fork 429
Add node:sqlite benchmark #1334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,3 +12,12 @@ exports['node-sqlite3'] = async (db, { table, columns, count }) => { | |
| let rowid = -100; | ||
| return () => db.all(sql, (rowid += 100) % count + 1); | ||
| }; | ||
|
|
||
| exports['node:sqlite'] = (db, { table, columns, count }) => { | ||
| const sql = `SELECT ${columns.join(', ')} FROM ${table} WHERE rowid >= ? LIMIT 100`; | ||
| let rowid = -100; | ||
| return () => { | ||
| const stmt = db.prepare(sql); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| return stmt.all((rowid += 100) % count + 1); | ||
| } | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,19 @@ exports['node-sqlite3'] = async (db, { table, columns, count }) => { | |
| })(); | ||
| }; | ||
| }; | ||
|
|
||
| exports['node:sqlite'] = (db, { table, columns, count }) => { | ||
| const sql = `SELECT ${columns.join(', ')} FROM ${table} WHERE rowid >= ? LIMIT 100`; | ||
| let rowid = -100; | ||
|
|
||
| if (!("iterate" in require("node:sqlite").StatementSync.prototype)) { | ||
| // Error: StatementSync.iterate is not a function (added in Node v23.4.0+) | ||
| return () => {}; | ||
| } | ||
|
|
||
| return () => { | ||
| // Error: statement has been finalized | ||
| // for (const row of db.prepare(sql).iterate((rowid += 100) % count + 1)) {} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll probably wait to merge this until
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I made this there were a few issues with |
||
| return () => {}; | ||
| }; | ||
| }; | ||
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.
What's the purpose of
...process.execArgv?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.
If you don't pass
--experimental-sqliteto node, thenode:sqlitemodule will not be available. This makes it so node child processes get the same node-specific arguments as the parent.