tursodatabase / tursodatabase/libsql-js

Improve performance

Open
#121 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue help wanted
Dominant language
JavaScript
Stars
335
Forks
48
Avg merge
3d 2h
Merged PRs (30d)
3

Description

We are still a bit behind better-sqlite3. For example, there's more overhead in get():

penberg@vonneumann libsql-js % node perf/perf-libsql.js

cpu: Apple M1
runtime: node v18.19.0 (arm64-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p999
------------------------------------------------- -----------------------------
• Statement
------------------------------------------------- -----------------------------
get(1)      1'969 ns/iter   (1'911 ns … 2'539 ns)  1'970 ns  2'424 ns  2'539 ns

summary for Statement
  get(1)

penberg@vonneumann libsql-js % node perf/perf-better-sqlite3.js
cpu: Apple M1
runtime: node v18.19.0 (arm64-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p999
------------------------------------------------- -----------------------------
• Statement
------------------------------------------------- -----------------------------
get(1)        587 ns/iter     (555 ns … 1'122 ns)    584 ns    944 ns  1'122 ns

The assumption that a lot of this is memory memory allocations and copies as values are passed between the C, Rust, and JavaScirpt layers. We also suspect that Neon Bindings may be less efficient than better-sqlite3 is which seems to hook into the V8 APIs directly.

Let's improve the benchmarks, profile, and fix performance to be on-par with better-sqlite3.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running perf/perf-libsql.js and perf/perf-better-sqlite3.js to reproduce the reported get(1) gap, then profile the benchmark across the C, Rust, and JavaScript layers. Done means improved benchmarks and performance on par with better-sqlite3, with the relevant profiling results supporting the change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, rust, sqlite
Domain
backend, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.