Skip to content

Conversation

@kriszyp
Copy link
Member

@kriszyp kriszyp commented Dec 27, 2025

According to the benchmarks, this improves the performance of getSync calls by about 2x and get calls by about 2.5x (at least in the common case of cached values).
With getSync, the breakdown of time spent is now about 420ns spent on the RocksDB side, and 240ns spent in this library (bindings and JS). Since it was about twice as slow before, I think it was previously spending about 800ns in this library, so really the performance gain on this side is 3-4x (and even more with get). At this point, RocksDB is dominating the time spent, so this puts us in a good position. This still isn't as fast as LMDB. However, once we get a better cache layer implemented, we might be competitive.
This also fixes an issue with tracking the key in the AsyncGetState. Previously this was held by a RocksDB Slice, which does not copy or own the target reference, and so it could change before the async task was called. The key is now safely copied into a std::string. The concurrent get test I added fails on main due to this problem, but is corrected in this branch.

@kriszyp kriszyp changed the title Use shared buffers for transferring keys and values for fast getSync Use shared buffers for transferring keys and values for fast get/getSync Dec 29, 2025
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.

2 participants