Skip to content
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

use sync.Pool to optimize db.Put operation #235

Closed
roseduan opened this issue Jul 28, 2023 · 3 comments
Closed

use sync.Pool to optimize db.Put operation #235

roseduan opened this issue Jul 28, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@roseduan
Copy link
Collaborator

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

@roseduan roseduan added the enhancement New feature or request label Jul 28, 2023
@tobehardest
Copy link

I will finish it.

@Jeremy-Run
Copy link
Contributor

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

@roseduan
Copy link
Collaborator Author

roseduan commented Aug 3, 2023

Thanks, I have done this in commit 02c9953

you can add it to lotusdb if you want.

@roseduan roseduan closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants