-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiread #13
Comments
Should benefit very much, I think @juliangruber had something similar in Leveled? We can do multi-threaded It's interesting to think about this in relation to a range delete cause they could share a similar API. db.getAll(array, cb)
db.delAll(array, cb)
db.delRange(options, cb) // where options is the same as for db.readStream()
db.getRange(options, cb) // where options is the same as for db.readStream() Of course the |
I had With a multiget the gain would increase with the numbers of keys given. I'm not sure yet about when this would pay off. Someone would have to do an implementation so we can see. Oh, and I'm for overloading the |
getRange could just alias to iterator, with the limit set very large. see section about the "The Hole Hawg" in this article http://artlung.com/smorgasborg/C_R_Y_P_T_O_N_O_M_I_C_O_N.shtml |
ref #9 Marking as "help wanted" if someone wants to come up with an interesting solution for this that we may want to consider merging in. Again, unlikely to be something exposed at the LevelUP layer but might be nice to have down here. |
Hi there, I've implemented this functionality, it looks like this:
options are the same ones used by .get (... options, ...). keys is an array of strings / buffers. In my use case I'm actually checking for pre-existing non-consecutive keys before insertion. I did some benchmarks with 1 million keys and found some interesting results:
I followed other methods implementation, so had to edit both abstract-leveldown and leveldown. Added these methods: abstract-leveldown -> AbstractLevelDOWN.prototype.map (parameter validation, options defaults, call to this._map) My question is if I should pull-request the two separate github projects (abstract-leveldown & leveldown) or should I modify the implementation to keep all changes inside levedown? abstract-leveldown could polyfill ._map implementation when not found, by issuing ._get by hand for every supplied key instead (however this Don't hesitate to ask me any question, english is not my native language and I may have screwed the explanation a bit 😄 |
@matonga nice work! With
Would be interesting to compare that against your native solution. I'm guessing yours will be faster because in theory it only has to cross the C++/JS boundary once. Is your code on GitHub? |
It's fine for a new feature to live in |
@vweevers that's right, I find it works faster, maybe because it crosses the C++/JS boundary once or maybe because there is less overhead (one Javascript call to Any suggestions welcome. Guess I should write some
Just in case, I've moved all code to |
Looks like a viable solution. We can discuss details in the PR :) It's up to you whether you want to write a test before opening a PR. It may help us to understand the intended behavior. It would be great if you can share your benchmarks as well (code and results). Thanks for taking this on! |
See Level/leveldown#13 for a description See https://github.com/matonga/leveldown for a LevelDB implementation of multiread
@vweevers thank you! good to see a multiread implementation being merged into leveldown and related repos at last. |
An operation that is like a batch, but for gets, but without the keys being adjacent in order.
I mention this because at campjs @rvagg and I discussed where the boundry between userland and core should be, regarding issues like: #9 (comment)
We couldn't think of many features that you might want to do in the C binding, but we decided that we should evaluate them on a case-by-case basis for a bit, until it becomes clearer.
So this issue is mainly intended for discussion, although it may be useful.
hmm, so for the purposes of discussion, the api is
Would an operation like this also benefit from crossing the c-js boundry only once,
passing an array each way?
The text was updated successfully, but these errors were encountered: