Skip to content

Commit 2fb3158

Browse files
committed
chore(README): fmt
1 parent f01f730 commit 2fb3158

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,17 @@ When choosing a SQLite library for Node.js, you have several excellent options.
231231

232232
### 🏷️ [`node:sqlite`](https://nodejs.org/docs/latest/api/sqlite.html) β€” Node.js Built-in Module
233233

234-
*The official SQLite module included with Node.js 22.5.0+ (experimental)*
234+
_The official SQLite module included with Node.js 22.5.0+ (experimental)_
235235

236236
**✨ Pros:**
237+
237238
- **Zero dependencies** β€” Built directly into Node.js
238239
- **Official support** β€” Maintained by the Node.js core team
239240
- **Clean synchronous API** β€” Simple, predictable blocking operations
240-
- **Full SQLite power** β€” FTS5, JSON functions, R*Tree, and more
241+
- **Full SQLite power** β€” FTS5, JSON functions, R\*Tree, and more
241242

242243
**⚠️ Cons:**
244+
243245
- **Experimental status** β€” Not yet stable for production use
244246
- **Requires Node.js 22.5.0+** β€” Won't work on older versions
245247
- **Flag required** β€” Must use `--experimental-sqlite` to enable
@@ -252,14 +254,16 @@ When choosing a SQLite library for Node.js, you have several excellent options.
252254

253255
### πŸš€ [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3) β€” The Performance Champion
254256

255-
*The most popular high-performance synchronous SQLite library*
257+
_The most popular high-performance synchronous SQLite library_
256258

257259
**✨ Pros:**
260+
258261
- **Blazing fast** β€” 2-15x faster than async alternatives
259262
- **Rock-solid stability** β€” Battle-tested in thousands of production apps
260263
- **Rich feature set** β€” User functions, aggregates, virtual tables, extensions
261264

262265
**⚠️ Cons:**
266+
263267
- **Different API** β€” Not compatible with Node.js built-in SQLite
264268
- **V8-specific** β€” Requires separate builds for each Node.js version
265269
- **Synchronous only** β€” No async operations (usually a feature, not a bug)
@@ -271,9 +275,10 @@ When choosing a SQLite library for Node.js, you have several excellent options.
271275

272276
### πŸ“¦ [`sqlite3`](https://github.com/TryGhost/node-sqlite3) β€” The Async Classic
273277

274-
*The original asynchronous SQLite binding for Node.js*
278+
_The original asynchronous SQLite binding for Node.js_
275279

276280
**✨ Pros:**
281+
277282
- **Battle-tested legacy** β€” 10+ years of production use
278283
- **Massive ecosystem** β€” 4000+ dependent packages
279284
- **Truly asynchronous** β€” Non-blocking operations won't freeze your app
@@ -282,6 +287,7 @@ When choosing a SQLite library for Node.js, you have several excellent options.
282287
- **Node-API stable** β€” One build works across Node.js versions
283288

284289
**⚠️ Cons:**
290+
285291
- **Significantly slower** β€” 2-15x performance penalty vs synchronous libs
286292
- **Callback complexity** β€” Prone to callback hell without careful design
287293
- **Unnecessary overhead** β€” SQLite is inherently synchronous anyway
@@ -295,6 +301,7 @@ When choosing a SQLite library for Node.js, you have several excellent options.
295301
## 🎯 Quick Decision Guide
296302

297303
### Choose **`@photostructure/sqlite`** when you want:
304+
298305
- βœ… **Future-proof code** that works with both this package AND `node:sqlite`
299306
- βœ… **Node.js API compatibility** without waiting for stable release
300307
- βœ… **Broad Node.js support** (v20+) without experimental flags
@@ -303,16 +310,19 @@ When choosing a SQLite library for Node.js, you have several excellent options.
303310
- βœ… **Zero migration path** when `node:sqlite` becomes stable
304311

305312
### Choose **`better-sqlite3`** when you want:
313+
306314
- βœ… The most mature and feature-rich synchronous SQLite library
307315
- βœ… Maximum performance above all else
308316
- βœ… A specific API design that differs from Node.js
309317

310318
### Choose **`sqlite3`** when you have:
319+
311320
- βœ… Legacy code using async/callback patterns
312321
- βœ… Hard requirement for non-blocking operations
313322
- βœ… Need for SQLCipher encryption
314323

315324
### Choose **`node:sqlite`** when you're:
325+
316326
- βœ… Experimenting with bleeding-edge Node.js features
317327
- βœ… Building proof-of-concepts for future migration
318328
- βœ… Working in environments where you control the Node.js version

β€Žbenchmark/README.mdβ€Ž

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,26 @@ The benchmark outputs clean markdown tables that can be directly copied into doc
121121
122122
### πŸ“ˆ Summary
123123
124-
| Scenario | @photostructure/sqlite | better-sqlite3 | node:sqlite | sqlite3 |
125-
|---|---:|---:|---:|---:|
126-
| SELECT by Primary Key | 150,000 ops/s | 150,000 ops/s | 140,000 ops/s | 24,000 ops/s |
127-
| SELECT Range | 13,000 ops/s | 14,000 ops/s | 13,000 ops/s | 5,600 ops/s |
128-
| SELECT with Iterator | 710 ops/s | 860 ops/s | 750 ops/s | 610 ops/s |
129-
| INSERT Single Row | 720 ops/s | 720 ops/s | 740 ops/s | 710 ops/s |
130-
| INSERT in Transaction | 340 ops/s | 350 ops/s | 350 ops/s | 38 ops/s |
131-
| SELECT with JOIN | 1,800 ops/s | 2,000 ops/s | 1,800 ops/s | 1,600 ops/s |
132-
| INSERT with BLOB | 640 ops/s | 660 ops/s | 650 ops/s | 590 ops/s |
133-
| UPDATE with Index | 750 ops/s | 720 ops/s | 740 ops/s | 720 ops/s |
134-
| DELETE Bulk | 89 ops/s | 90 ops/s | 83 ops/s | 25 ops/s |
135-
124+
| Scenario | @photostructure/sqlite | better-sqlite3 | node:sqlite | sqlite3 |
125+
| --------------------- | ---------------------: | -------------: | ------------: | -----------: |
126+
| SELECT by Primary Key | 150,000 ops/s | 150,000 ops/s | 140,000 ops/s | 24,000 ops/s |
127+
| SELECT Range | 13,000 ops/s | 14,000 ops/s | 13,000 ops/s | 5,600 ops/s |
128+
| SELECT with Iterator | 710 ops/s | 860 ops/s | 750 ops/s | 610 ops/s |
129+
| INSERT Single Row | 720 ops/s | 720 ops/s | 740 ops/s | 710 ops/s |
130+
| INSERT in Transaction | 340 ops/s | 350 ops/s | 350 ops/s | 38 ops/s |
131+
| SELECT with JOIN | 1,800 ops/s | 2,000 ops/s | 1,800 ops/s | 1,600 ops/s |
132+
| INSERT with BLOB | 640 ops/s | 660 ops/s | 650 ops/s | 590 ops/s |
133+
| UPDATE with Index | 750 ops/s | 720 ops/s | 740 ops/s | 720 ops/s |
134+
| DELETE Bulk | 89 ops/s | 90 ops/s | 83 ops/s | 25 ops/s |
136135
137136
### πŸ† Overall Performance Ranking
138137
139-
| Rank | Driver | Score |
140-
|---:|---|---:|
141-
| 1 πŸ₯‡ | better-sqlite3 | 99% |
142-
| 2 πŸ₯ˆ | @photostructure/sqlite | 94% |
143-
| 3 πŸ₯‰ | node:sqlite | 94% |
144-
| 4 🐌 | sqlite3 | 58% |
138+
| Rank | Driver | Score |
139+
| ---: | ---------------------- | ----: |
140+
| 1 πŸ₯‡ | better-sqlite3 | 99% |
141+
| 2 πŸ₯ˆ | @photostructure/sqlite | 94% |
142+
| 3 πŸ₯‰ | node:sqlite | 94% |
143+
| 4 🐌 | sqlite3 | 58% |
145144
146145
Key features:
147146

0 commit comments

Comments
Β (0)