-
-
Notifications
You must be signed in to change notification settings - Fork 16
Add getSync()
method
#144
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
Comments
vweevers
added a commit
to Level/classic-level
that referenced
this issue
Apr 12, 2025
Also optimizes `db.get()` to avoid a copy of the key if it's a buffer. Depends on Level/abstract-level#114. Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/classic-level
that referenced
this issue
Apr 12, 2025
Also optimizes `db.get()` to avoid a copy of the key if it's a buffer. Relies on a patch to LevelDB that replaces use of `std::string` with a new ValueSink struct that gives us more control over the memory. Depends on Level/abstract-level#114. Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/abstract-level
that referenced
this issue
Apr 12, 2025
vweevers
added a commit
to Level/classic-level
that referenced
this issue
Apr 12, 2025
Also optimizes `db.get()` to avoid a copy of the key if it's a buffer. Relies on a patch to LevelDB that replaces use of `std::string` with a new ValueSink struct that gives us more control over the memory. Depends on Level/abstract-level#114. Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/classic-level
that referenced
this issue
Apr 20, 2025
Also optimizes `db.get()` to avoid a copy of the key if it's a buffer. Relies on a patch to LevelDB that replaces use of `std::string` with a new ValueSink struct that gives us more control over the memory. Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/classic-level
that referenced
this issue
Apr 20, 2025
Also optimizes `db.get()` to avoid a copy of the key if it's a buffer. Relies on a patch to LevelDB that replaces use of `std::string` with a new ValueSink struct that gives us more control over the memory. Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/memory-level
that referenced
this issue
Apr 20, 2025
Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/memory-level
that referenced
this issue
Apr 20, 2025
Ref: Level/community#144 Category: addition
vweevers
added a commit
to Level/browser-level
that referenced
this issue
Apr 20, 2025
Ref: Level/community#144 Category: none
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As the synchronous equivalent of
db.get()
:Good to have because it's much faster. It doesn't have the overhead of scheduling asynchronous work or copying data from that thread to the JavaScript main thread. It also enables an optimization of reusing a buffer for the data transfer, knowing that only 1 thread at a time needs access to that buffer. I did a POC of that in
classic-level
having seen the same trick inlmdb
and (although I only implemented it forkeyEncoding: 'utf8'
) it worked rather well without adding too much complexity. The only unfortunate thing is that LevelDB'sGet()
method copies the data into anstd::string
and has no alternative API to avoid that intermediary buffer (and a double copy). Maybe it's worth a patch. The upstream code doesn't change often so I think that'd be okay.Tasks
abstract-level
(3.1.0): AddgetSync()
method abstract-level#114level-bench
: replace the old callback-based API so we can run benchmarks againclassic-level
(3.0.0): Adddb.getSync()
method classic-level#120memory-level
(3.1.0): Implementdb.getSync()
memory-level#21browser-level
: document that it's not supportedlevel
(10.0.0): bump dependenciesThe text was updated successfully, but these errors were encountered: