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

core, ethdb, tests, trie: implement NewBatchWithSize API for batcher #24392

Merged
merged 1 commit into from Feb 15, 2022

Commits on Feb 15, 2022

  1. core, ethdb, tests, trie: implement NewBatchWithSize API for batcher

    This PR adds an addtional API called `NewBatchWithSize` for db
    batcher. It turns out that leveldb batch memory allocation is
    super inefficient. The main reason is the allocation step of
    leveldb Batch is too small when the batch size is large. It can
    take a few second to build a leveldb batch with 100MB size.
    
    Luckily, leveldb also offers another API called MakeBatch which can
    pre-allocate the memory area. So if the approximate size of batch is
    known in advance, this API can be used in this case.
    
    It's needed in new state scheme PR which needs to commit a batch of
    trie nodes in a single batch. Implement the feature in a seperate PR.
    rjl493456442 committed Feb 15, 2022
    Copy the full SHA
    f7b1e9d View commit details
    Browse the repository at this point in the history