rosedblabs / rosedb

Lightweight, fast and reliable key/value storage engine based on Bitcask.

Home Page:https://rosedblabs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use sync.Pool to optimize db.Put operation

roseduan opened this issue · comments

Now the db.Put operation will create a new batch every time, which may cause too much memory allocation.
We can use sync.Pool to avoid this.

The goleveldb has done this, see https://github.com/syndtr/goleveldb/blob/master/leveldb/db_write.go#L362

I will finish it.

commented

Now the db.Put operation will create a new batch every time, which may cause too much memory allocation. We can use sync.Pool to avoid this.

The goleveldb has done this, see https://github.com/syndtr/goleveldb/blob/master/leveldb/db_write.go#L362

That's a good idea

Thanks, I have done this in commit 02c9953

you can add it to lotusdb if you want.