Skip to content
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

feat(ext/node): implement node:sqlite #27308

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Dec 10, 2024

@littledivy littledivy marked this pull request as ready for review December 15, 2024 03:21
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you maybe enable some of the tests/node_compat/ cases?

Cargo.toml Outdated Show resolved Hide resolved
cli/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR, but... we should have a deno.json file in cli/bench to run various benchmarks. I never remember how to run them and it feels like half of them are already code-rotted.

cli/lsp/tsc.rs Outdated
@@ -4496,6 +4496,7 @@ impl<'a> ToV8<'a> for TscRequestArray {

let method_name = deno_core::FastString::from_static(method_name)
.v8_string(scope)
.unwrap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I must have missed that. Why is it now a Result/Option?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ext/node/ops/sqlite/database.rs Show resolved Hide resolved
ext/node/ops/sqlite/statement.rs Outdated Show resolved Hide resolved
@bartlomieju bartlomieju added this to the 2.2.0 milestone Dec 15, 2024
littledivy added a commit that referenced this pull request Dec 16, 2024
upgrades itoa requirement to `1.0.14`. needed for #27308
Copy link

@lilnasy lilnasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that node:sqlite is still experimental in Node, should this be behind a flag?

Also, I noticed that the jsr:@db/sqlite@0.12 is still faster when reading a table with 620k rows from the northwind dataset. 483ms vs 3.5s. Does the jsr library use different defaults that might explain it?

Benchmark results with node built-in, deno built-in, and @db/sqlite
bench/sqlite (main) $ node node.mjs
(node:34767) ExperimentalWarning: SQLite is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
cpu: AMD EPYC 7B13
runtime: node v23.6.0 (x64-linux)

benchmark                        time (avg)             (min … max)       p75       p99      p999
------------------------------------------------------------------- -----------------------------
SELECT * FROM "Order"        85'356 µs/iter (80'886 µs … 92'799 µs) 87'445 µs 92'799 µs 92'799 µs
SELECT * FROM "Product"         214 µs/iter       (173 µs … 527 µs)    222 µs    373 µs    494 µs
SELECT * FROM "OrderDetail"   3'797 ms/iter   (3'335 ms … 4'068 ms)  4'037 ms  4'068 ms  4'068 ms


bench/sqlite (main) $ ./deno -A node.mjs
cpu: AMD EPYC 7B13
runtime: deno 2.1.4 (x86_64-unknown-linux-gnu)

benchmark                        time (avg)             (min … max)       p75       p99      p999
------------------------------------------------------------------- -----------------------------
SELECT * FROM "Order"        69'557 µs/iter (63'264 µs … 73'822 µs) 72'497 µs 73'822 µs 73'822 µs
SELECT * FROM "Product"         193 µs/iter       (149 µs … 567 µs)    200 µs    331 µs    490 µs
SELECT * FROM "OrderDetail"   3'513 ms/iter   (3'385 ms … 3'664 ms)  3'629 ms  3'664 ms  3'664 ms


bench/sqlite (main) $ ./deno run -A --unstable-ffi deno.js
cpu: AMD EPYC 7B13
runtime: deno 2.1.4 (x86_64-unknown-linux-gnu)

benchmark                        time (avg)             (min … max)       p75       p99      p999
------------------------------------------------------------------- -----------------------------
SELECT * FROM "Order"        48'654 µs/iter (46'948 µs … 51'232 µs) 49'696 µs 51'232 µs 51'232 µs
SELECT * FROM "Product"         121 µs/iter  (88'408 ns … 2'454 µs)    126 µs    225 µs  2'183 µs
SELECT * FROM "OrderDetail"     491 ms/iter       (465 ms … 523 ms)    515 ms    523 ms    523 ms

dsherret pushed a commit that referenced this pull request Jan 9, 2025
upgrades itoa requirement to `1.0.14`. needed for #27308
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.

Tracking issue for node:sqlite
3 participants