Skip to content

Commit

Permalink
Handle errors in node:http better (#12641)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarred-Sumner <[email protected]>
  • Loading branch information
Jarred-Sumner and Jarred-Sumner authored Jul 27, 2024
1 parent d547d8a commit e5ac4f9
Show file tree
Hide file tree
Showing 10 changed files with 577 additions and 321 deletions.
31 changes: 31 additions & 0 deletions bench/sqlite/better-sqlite3.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { run, bench } from "mitata";
import { createRequire } from "module";

const require = createRequire(import.meta.url);
const db = require("better-sqlite3")("./src/northwind.sqlite");

{
const sql = db.prepare(`SELECT * FROM "Order"`);

bench('SELECT * FROM "Order"', () => {
sql.all();
});
}

{
const sql = db.prepare(`SELECT * FROM "Product"`);

bench('SELECT * FROM "Product"', () => {
sql.all();
});
}

{
const sql = db.prepare(`SELECT * FROM "OrderDetail"`);

bench('SELECT * FROM "OrderDetail"', () => {
sql.all();
});
}

await run();
7 changes: 4 additions & 3 deletions bench/sqlite/node.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Run `node --experimental-sqlite bench/sqlite/node.mjs` to run the script.
// You will need `--experimental-sqlite` flag to run this script and node v22.5.0 or higher.
import { run, bench } from "mitata";
import { createRequire } from "module";
import { DatabaseSync as Database } from "node:sqlite";

const require = createRequire(import.meta.url);
const db = require("better-sqlite3")("./src/northwind.sqlite");
const db = new Database("./src/northwind.sqlite");

{
const sql = db.prepare(`SELECT * FROM "Order"`);
Expand Down
Loading

0 comments on commit e5ac4f9

Please sign in to comment.