Golang benchmarks used for optimizing code. The benchmarks were run with Golang 1.22.0 and 64 bit CPU on Linux using make benchmark-perflock
.
interface{} vs unsafe.Pointer
ValueUnsafePointer-8 23.52n ± 5%
ValueInterface-8 245.8n ± 13%
Defer-8 256.1n ± 7%
DeferNo-8 124.9n ± 10%
SliceReadRange-8 21.11n ± 5%
SliceReadForward-8 36.12n ± 6%
SliceReadBackwards-8 36.56n ± 6%
SliceReadLastItemFirst-8 36.38n ± 5%
ParameterPassedByPointer-8 10.94n ± 9%
ParameterPassedByValue-8 10.96n ± 4%
Reflect-8 344.8n ± 5%
Cast-8 236.1n ± 7%
Hashing64MD5-8 140.5n ± 1%
Hashing64SHA1-8 170.4n ± 2%
Hashing64SHA256-8 124.9n ± 1%
Hashing64SHA3B224-8 697.2n ± 2%
Hashing64SHA3B256-8 693.5n ± 1%
Hashing64RIPEMD160-8 382.2n ± 2%
Hashing64Blake2B-8 377.4n ± 1%
Hashing64Blake2BSimd-8 347.4n ± 1%
Hashing64Murmur3-8 58.18n ± 2%
Hashing64Murmur3Twmb-8 57.77n ± 2%
Hashing64SipHash-8 59.51n ± 4%
Hashing64XXHash-8 36.08n ± 2%
Hashing64XXHashpier-8 41.67n ± 1%
Hashing64HighwayHash-8 96.17n ± 1%
SliceFillByIndex-8 15.88n ± 3%
SliceFillByIndexMake-8 15.83n ± 2%
SliceFillMakeAppend-8 40.36n ± 2%
SliceFillAppendNoMake-8 271.4n ± 6%
SliceFillSmallMakeAppend-8 338.2n ± 1%
AtomicInt32-8 956.8n ± 2%
AtomicInt64-8 958.1n ± 3%
AtomicUintptr-8 951.5n ± 5%