SIGN IN SIGN UP
etcd-io / etcd UNCLAIMED

Distributed reliable key-value store for the most critical data of a distributed system

0 0 159 Go

robustness: optimize WAL entry comparison in history merging

Replaces slow reflection-based 'cmp.Equal' and 'protocmp.Transform()' comparisons in 'mergeMembersEntries' with a custom, direct 'areEntriesEqual' helper. This helper leverages generated protobuf getters to compare fields directly, bypassing reflection while correctly supporting default-value comparisons. A simplified reflection mutation safeguard is also added to prevent the helper from drifting.

benchstat comparison:
goos: linux
goarch: amd64
pkg: go.etcd.io/etcd/tests/v3/robustness/report
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
                      │ current_results.txt │          new_results.txt          │
                      │       sec/op        │   sec/op     vs base              │
MergeMemberEntries-24        615867.3µ ± 3%   390.1µ ± 0%  -99.94% (p=0.002 n=6)

                      │ current_results.txt │           new_results.txt         │
                      │        B/op         │     B/op      vs base             │
MergeMemberEntries-24        56801.2Ki ± 0%   173.3Ki ± 0%  -99.69% (p=0.002 n=6)

                      │ current_results.txt │          new_results.txt          │
                      │      allocs/op      │  allocs/op   vs base              │
MergeMemberEntries-24         818.258k ± 0%   4.008k ± 0%  -99.51% (p=0.002 n=6)

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
M
Marek Siarkowicz committed
eda36fb5366e0227f125776f48ee14f621334c46
Parent: 6ab8664