-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
base: master
Are you sure you want to change the base?
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); | ||
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)) {} | ||
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 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-sqlite
to node, thenode:sqlite
module will not be available. This makes it so node child processes get the same node-specific arguments as the parent.