by klabb3 · 3y ago · 0 comments
100k inserts using `better-sqlite3` (difference: it does use prepared statements), all single-threaded with the same pragmas.
- 8.6k inserts/s with `uuid` and `Date.toUTCString()`
- 12.0k inserts/s with faking uuid and date (generated unique strings)
...So a large amount of time was spend in uuid generation and current date.
EDIT: I mixed up the two numbers above. Simple strings is of course faster than syscall+date format+entropy. Fixed now.
It's fair to say that although Rust is slightly more Web Scale, this benchmark simply measures the excellent performance of SQLite.
However, I did it again with this example and Bun is indeed significantly faster
- 15.1k inserts/s with `uuid` and `Date.toUTCString()`
- 20k inserts/s with faking uuid and date (generated unique strings)
Bun is now scientifically at the Rust level of Web Scale, which is pretty crazy. I wonder how they do that, because it's still just v8 under the hood? Mayhaps their sqlite driver is faster.
There are still "obvious" things we need to fix, like our EventEmitter implementation is currently around 3x slower than Node due to C++ <> JS callback overhead and several functions in node:crypto are still using JS-only polyfills intended for web browsers (instead of BoringSSL/OpenSSL).
It was a very similar SQLite bench but I may have done something wrong.
> Happy to take a look.
That’s ok but let me bait and switch you for this dead socket leak issue: https://github.com/oven-sh/bun/issues/1397
In general, I’ve found that tons of projects suffer leaks. People don’t care about leaks :( (or alternative the tooling for discovering them kinda sucks)