bytes.Compare() is used with keys inside BadgerDB, and is about 35% slower than using binary.BigEndian

I tested using an alternative to bytes.Compare, where the keys being compared are 32-byte values. It turns out that bytes.Compare() is about 35% slower than using binary.BigEndian.Uint64() for comparisons.

What version of Go are you using (go version)?


What operating system are you using?

Linux GPC instance (from Google)

What version of Badger are you using?

Latest (as of 11/8/2021), v3

Does this issue reproduce with the latest master?


Steps to Reproduce the issue

use Badger

What Badger options were set?

What did you do?

What did you expect to see?

What did you see instead?