-
-
Notifications
You must be signed in to change notification settings - Fork 52
Open to adding an optional "batched get" capability? #367
Comments
Thank you for the detailed problem description. For prior discussion, see Level/levelup#491 and Level/levelup#491 (comment). I'm open to the idea. The current API does support getting multiple keys from a single iterator, with
We can't reuse |
Ah, I see! This is a pretty clear dupe of Level/levelup#491 and Level/levelup#13 (sorry I missed those!), so let's go ahead and close this.
Yes, I see how this could be done, but in the case of random-access read, it still requires 2N FFI round-trips per requested key; I'd like a constant-overhead interface. Having read the discussion and some of the considerations involved, I'll probably go ahead and just implement this in my own library (https://github.com/andymatuschak/react-native-leveldown) and link it in the relevant issues here in case others want to implement a similar API. |
Did you ever implement this @andymatuschak? |
Nope, and my plans have changed; I'm no longer likely to! |
Many implementations of
abstract-leveldown
involve FFI, which often incurs transaction overhead. There are good ways to mitigate this overhead for writes and for iterators (the batch API and chunked reads, respectively), but there's no good way to avoid significant FFI overhead when making large numbers of random-accessget
calls. Existing implementors can batch reads at everytick
, but that approach introduces delay for common-case simple reads, as well as extra bookkeeping to track information the client may already have.How would you all feel about a proposal to make
get
accept an array of keys? This would be an optional feature, with support indicated by a newsupports
manifest key (e.g.batchedGet
). If there's support for this feature, I'm willing to write a more formal proposal describing its semantics in more detail, implement demonstration support inmemdown
, and add appropriate tests.The text was updated successfully, but these errors were encountered: