tikv / raft-engine

A persistent storage engine for Multi-Raft log
Apache License 2.0
565 stars 88 forks source link

Use VecDeque for storing entry indexes in log batch #174

Closed tabokie closed 2 years ago

tabokie commented 2 years ago

After https://github.com/rust-lang/rust/pull/88717, append is favored over extend-ing a Vec. This PR updates toolchain and change all entry indexes containers to VecDeque.

Micro-benchmark shows 6% improvements when appending 10 indexes:

vec:
test memtable::tests::bench_memtable_append                 ... bench:         350 ns/iter (+/- 67)
test memtable::tests::bench_memtable_append                 ... bench:         347 ns/iter (+/- 21)
vecdeque:
test memtable::tests::bench_memtable_append                 ... bench:         328 ns/iter (+/- 49)
test memtable::tests::bench_memtable_append                 ... bench:         326 ns/iter (+/- 36)