diff --git a/common/maphash/comparable_go120.go b/common/maphash/comparable_go120.go index 05256d67..b4ddad84 100644 --- a/common/maphash/comparable_go120.go +++ b/common/maphash/comparable_go120.go @@ -138,3 +138,5 @@ func escape[T any](x T) T { // ptrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant. // It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit). const ptrSize = 4 << (^uintptr(0) >> 63) + +const testComparableAllocations = false diff --git a/common/maphash/comparable_go124.go b/common/maphash/comparable_go124.go index 3a96edb6..4e5fcc33 100644 --- a/common/maphash/comparable_go124.go +++ b/common/maphash/comparable_go124.go @@ -11,3 +11,5 @@ func Comparable[T comparable](seed Seed, v T) uint64 { func WriteComparable[T comparable](h *Hash, x T) { maphash.WriteComparable(h, x) } + +const testComparableAllocations = true diff --git a/common/maphash/maphash_test.go b/common/maphash/maphash_test.go index 73887f27..6cafe9cb 100644 --- a/common/maphash/maphash_test.go +++ b/common/maphash/maphash_test.go @@ -423,7 +423,9 @@ func TestWriteComparableNoncommute(t *testing.T) { } func TestComparableAllocations(t *testing.T) { - t.Skip("test broken in old golang version") + if !testComparableAllocations { + t.Skip("test broken in old golang version") + } seed := MakeSeed() x := heapStr(t) allocs := testing.AllocsPerRun(10, func() {