Comments (5)
That's reasonable. Would only require work in the constructor.
Slightly easier to achieve in abstract-level
because its db.sublevel()
method has less overloads. There it could look like db.sublevel(['foo', bar'])
as a shortcut for db.sublevel('foo').sublevel('bar')
.
from subleveldown.
Yea that would be useful, I was also wondering why it requires await
or a callback to create a sublevel, when sublevels are just objects, and don't involve any changes to the DB.
In some cases, I have functions that will just create iterators directly to a specific sublevel, and I'm wondering about the performance impact of creating 3/4 deep sublevels every time I call that function.
from subleveldown.
I was also wondering why it requires
await
It doesn't. Can you share a snippet of code where you need await
?
from subleveldown.
I had to do it in #109. That's the code I'm using to open sublevels: #109 (comment)
from subleveldown.
Using my sublevel opener above, creating deeply nested sublevels right now costs quite a significant amount of time. My benchmarks show:
create 1 sublevels:
87 320 ops/s, ±0.79% | fastest
create 2 sublevels:
45 325 ops/s, ±0.55% | 48.09% slower
create 3 sublevels:
30 294 ops/s, ±0.39% | 65.31% slower
create 4 sublevels:
22 764 ops/s, ±2.34% | slowest, 73.93% slower
get via sublevel:
25 055 ops/s, ±1.36% | 71.31% slower
get via key path concatenation:
54 992 ops/s, ±2.68% | 37.02% slower
Basically it seems like db.sublevel(['foo', bar'])
would be implemented efficiently as db.sublevel('foo!bar')
so that the key path is just concatenated rather than creating intermediate sublevel objects.
Right now !
is not even allowed in the parameter due to #111 , so this would have be supported internal to subleveldown.
from subleveldown.
Related Issues (20)
- How to get the exception `Inner database is not open`? HOT 2
- Support buffer/Uint8Array prefixes HOT 7
- Release v3.0.0 HOT 1
- Streams are ignoring fillCache option HOT 2
- Segfault with subleveldown HOT 27
- bytewise key-encoding on sub-level causes not found on other level HOT 20
- Adding _seek to SubIterator HOT 4
- Disable `clear()` HOT 2
- Take advantage of manifests and the squash down HOT 1
- An in-range update of abstract-leveldown is breaking the build 🚨 HOT 3
- Applies prefix twice on nested sublevel HOT 12
- An in-range update of levelup is breaking the build 🚨 HOT 2
- Remove unnecessary condition HOT 1
- Drop support of memdb
- Require deferredOpen support HOT 1
- Support "deep" option in clear() & iterator() HOT 10
- Possible issue with buffer keys HOT 10
- Decoder Err ! HOT 3
- Should the `createReadStream` method be scoped to the subs? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subleveldown.