mirror of
https://github.com/gogrlx/bitcask.git
synced 2026-04-02 02:58:59 -07:00
Improve Get/Put performance with optional mempooling (#36)
* avoid unnecessary use of encoder/decoder to decrease memory allocations * add an optional configurable mempool to avoid extra allocs * add doc.go with examples
This commit is contained in:
committed by
James Mills
parent
6ceeccfd64
commit
a407905ae2
@@ -35,6 +35,10 @@ var (
|
||||
// ErrDatabaseLocked is the error returned if the database is locked
|
||||
// (typically opened by another process)
|
||||
ErrDatabaseLocked = errors.New("error: database locked")
|
||||
|
||||
// ErrCreatingMemPool is the error returned when trying to configurate
|
||||
// the mempool fails
|
||||
ErrCreatingMemPool = errors.New("error: creating the mempool failed")
|
||||
)
|
||||
|
||||
// Bitcask is a struct that represents a on-disk LSM and WAL data structure
|
||||
@@ -420,6 +424,8 @@ func Open(path string, options ...Option) (*Bitcask, error) {
|
||||
}
|
||||
}
|
||||
|
||||
internal.ConfigureMemPool(bitcask.config.maxConcurrency)
|
||||
|
||||
locked, err := bitcask.Flock.TryLock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user