plugeth/ethdb
rjl493456442 4d086430bd
core, ethdb, tests, trie: implement NewBatchWithSize API for batcher (#24392)
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.
2022-02-15 15:15:13 +02:00
..
dbtest all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00
leveldb core, ethdb, tests, trie: implement NewBatchWithSize API for batcher (#24392) 2022-02-15 15:15:13 +02:00
memorydb core, ethdb, tests, trie: implement NewBatchWithSize API for batcher (#24392) 2022-02-15 15:15:13 +02:00
batch.go core, ethdb, tests, trie: implement NewBatchWithSize API for batcher (#24392) 2022-02-15 15:15:13 +02:00
database.go core/rawdb, ethdb: introduce batched/atomic reads from ancients (#23566) 2021-10-25 16:24:27 +02:00
iterator.go all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00