// Code generated by mkmalloc.go; DO NOT EDIT. // See overview in malloc_stubs.go. package runtime_test import ( "internal/abi" "runtime" "testing" ) func benchmarkMallocgcNoscan8(b *testing.B) { const size = 8 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan8(b *testing.B) { const size = 8 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice8(b *testing.B) { const size = 8 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan16(b *testing.B) { const size = 16 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan16(b *testing.B) { const size = 16 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice16(b *testing.B) { const size = 16 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan24(b *testing.B) { const size = 24 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan24(b *testing.B) { const size = 24 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice24(b *testing.B) { const size = 24 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan32(b *testing.B) { const size = 32 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan32(b *testing.B) { const size = 32 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice32(b *testing.B) { const size = 32 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan48(b *testing.B) { const size = 48 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan48(b *testing.B) { const size = 48 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice48(b *testing.B) { const size = 48 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan64(b *testing.B) { const size = 64 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan64(b *testing.B) { const size = 64 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice64(b *testing.B) { const size = 64 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan80(b *testing.B) { const size = 80 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan80(b *testing.B) { const size = 80 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice80(b *testing.B) { const size = 80 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan96(b *testing.B) { const size = 96 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan96(b *testing.B) { const size = 96 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice96(b *testing.B) { const size = 96 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan112(b *testing.B) { const size = 112 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan112(b *testing.B) { const size = 112 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice112(b *testing.B) { const size = 112 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan128(b *testing.B) { const size = 128 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan128(b *testing.B) { const size = 128 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice128(b *testing.B) { const size = 128 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan144(b *testing.B) { const size = 144 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan144(b *testing.B) { const size = 144 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice144(b *testing.B) { const size = 144 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan160(b *testing.B) { const size = 160 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan160(b *testing.B) { const size = 160 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice160(b *testing.B) { const size = 160 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan176(b *testing.B) { const size = 176 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan176(b *testing.B) { const size = 176 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice176(b *testing.B) { const size = 176 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan192(b *testing.B) { const size = 192 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan192(b *testing.B) { const size = 192 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice192(b *testing.B) { const size = 192 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan208(b *testing.B) { const size = 208 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan208(b *testing.B) { const size = 208 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice208(b *testing.B) { const size = 208 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan224(b *testing.B) { const size = 224 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan224(b *testing.B) { const size = 224 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice224(b *testing.B) { const size = 224 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan240(b *testing.B) { const size = 240 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan240(b *testing.B) { const size = 240 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice240(b *testing.B) { const size = 240 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan256(b *testing.B) { const size = 256 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan256(b *testing.B) { const size = 256 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice256(b *testing.B) { const size = 256 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan288(b *testing.B) { const size = 288 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan288(b *testing.B) { const size = 288 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice288(b *testing.B) { const size = 288 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan320(b *testing.B) { const size = 320 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan320(b *testing.B) { const size = 320 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice320(b *testing.B) { const size = 320 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan352(b *testing.B) { const size = 352 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan352(b *testing.B) { const size = 352 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice352(b *testing.B) { const size = 352 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan384(b *testing.B) { const size = 384 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan384(b *testing.B) { const size = 384 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice384(b *testing.B) { const size = 384 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan416(b *testing.B) { const size = 416 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan416(b *testing.B) { const size = 416 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice416(b *testing.B) { const size = 416 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan448(b *testing.B) { const size = 448 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan448(b *testing.B) { const size = 448 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice448(b *testing.B) { const size = 448 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan480(b *testing.B) { const size = 480 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan480(b *testing.B) { const size = 480 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice480(b *testing.B) { const size = 480 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcNoscan512(b *testing.B) { const size = 512 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScan512(b *testing.B) { const size = 512 b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(struct{ v [size / 8]*uint64 })) } }) var typ *abi.Type typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, true)) } }) } func benchmarkMallocgcScanSlice512(b *testing.B) { const size = 512 for b.Loop() { runtime.Escape(make([]*uint64, size/8)) } } func benchmarkMallocgcTiny1(b *testing.B) { const size = 1 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny2(b *testing.B) { const size = 2 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny3(b *testing.B) { const size = 3 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny4(b *testing.B) { const size = 4 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny5(b *testing.B) { const size = 5 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny6(b *testing.B) { const size = 6 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny7(b *testing.B) { const size = 7 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny8(b *testing.B) { const size = 8 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny9(b *testing.B) { const size = 9 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny10(b *testing.B) { const size = 10 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny11(b *testing.B) { const size = 11 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny12(b *testing.B) { const size = 12 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny13(b *testing.B) { const size = 13 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny14(b *testing.B) { const size = 14 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func benchmarkMallocgcTiny15(b *testing.B) { const size = 15 type s struct { v [size]byte } b.Run("kind=new", func(b *testing.B) { for b.Loop() { runtime.Escape(new(s)) } }) typ := abi.TypeOf(s{}) b.Run("kind=mallocgc", func(b *testing.B) { for b.Loop() { runtime.Escape(runtime.MallocGC(size, typ, false)) } }) } func BenchmarkMallocgc(b *testing.B) { b.Run("scan=noscan", func(b *testing.B) { b.Run("size=1", benchmarkMallocgcTiny1) b.Run("size=2", benchmarkMallocgcTiny2) b.Run("size=3", benchmarkMallocgcTiny3) b.Run("size=4", benchmarkMallocgcTiny4) b.Run("size=5", benchmarkMallocgcTiny5) b.Run("size=6", benchmarkMallocgcTiny6) b.Run("size=7", benchmarkMallocgcTiny7) b.Run("size=8", benchmarkMallocgcTiny8) b.Run("size=9", benchmarkMallocgcTiny9) b.Run("size=10", benchmarkMallocgcTiny10) b.Run("size=11", benchmarkMallocgcTiny11) b.Run("size=12", benchmarkMallocgcTiny12) b.Run("size=13", benchmarkMallocgcTiny13) b.Run("size=14", benchmarkMallocgcTiny14) b.Run("size=15", benchmarkMallocgcTiny15) b.Run("size=16", benchmarkMallocgcNoscan16) b.Run("size=24", benchmarkMallocgcNoscan24) b.Run("size=32", benchmarkMallocgcNoscan32) b.Run("size=48", benchmarkMallocgcNoscan48) b.Run("size=64", benchmarkMallocgcNoscan64) b.Run("size=80", benchmarkMallocgcNoscan80) b.Run("size=96", benchmarkMallocgcNoscan96) b.Run("size=112", benchmarkMallocgcNoscan112) b.Run("size=128", benchmarkMallocgcNoscan128) b.Run("size=144", benchmarkMallocgcNoscan144) b.Run("size=160", benchmarkMallocgcNoscan160) b.Run("size=176", benchmarkMallocgcNoscan176) b.Run("size=192", benchmarkMallocgcNoscan192) b.Run("size=208", benchmarkMallocgcNoscan208) b.Run("size=224", benchmarkMallocgcNoscan224) b.Run("size=240", benchmarkMallocgcNoscan240) b.Run("size=256", benchmarkMallocgcNoscan256) b.Run("size=288", benchmarkMallocgcNoscan288) b.Run("size=320", benchmarkMallocgcNoscan320) b.Run("size=352", benchmarkMallocgcNoscan352) b.Run("size=384", benchmarkMallocgcNoscan384) b.Run("size=416", benchmarkMallocgcNoscan416) b.Run("size=448", benchmarkMallocgcNoscan448) b.Run("size=480", benchmarkMallocgcNoscan480) b.Run("size=512", benchmarkMallocgcNoscan512) }) b.Run("scan=scan", func(b *testing.B) { b.Run("size=8", benchmarkMallocgcScan8) b.Run("size=16", benchmarkMallocgcScan16) b.Run("size=24", benchmarkMallocgcScan24) b.Run("size=32", benchmarkMallocgcScan32) b.Run("size=48", benchmarkMallocgcScan48) b.Run("size=64", benchmarkMallocgcScan64) b.Run("size=80", benchmarkMallocgcScan80) b.Run("size=96", benchmarkMallocgcScan96) b.Run("size=112", benchmarkMallocgcScan112) b.Run("size=128", benchmarkMallocgcScan128) b.Run("size=144", benchmarkMallocgcScan144) b.Run("size=160", benchmarkMallocgcScan160) b.Run("size=176", benchmarkMallocgcScan176) b.Run("size=192", benchmarkMallocgcScan192) b.Run("size=208", benchmarkMallocgcScan208) b.Run("size=224", benchmarkMallocgcScan224) b.Run("size=240", benchmarkMallocgcScan240) b.Run("size=256", benchmarkMallocgcScan256) b.Run("size=288", benchmarkMallocgcScan288) b.Run("size=320", benchmarkMallocgcScan320) b.Run("size=352", benchmarkMallocgcScan352) b.Run("size=384", benchmarkMallocgcScan384) b.Run("size=416", benchmarkMallocgcScan416) b.Run("size=448", benchmarkMallocgcScan448) b.Run("size=480", benchmarkMallocgcScan480) b.Run("size=512", benchmarkMallocgcScan512) }) b.Run("scan=scanslice", func(b *testing.B) { b.Run("size=8", benchmarkMallocgcScanSlice8) b.Run("size=16", benchmarkMallocgcScanSlice16) b.Run("size=24", benchmarkMallocgcScanSlice24) b.Run("size=32", benchmarkMallocgcScanSlice32) b.Run("size=48", benchmarkMallocgcScanSlice48) b.Run("size=64", benchmarkMallocgcScanSlice64) b.Run("size=80", benchmarkMallocgcScanSlice80) b.Run("size=96", benchmarkMallocgcScanSlice96) b.Run("size=112", benchmarkMallocgcScanSlice112) b.Run("size=128", benchmarkMallocgcScanSlice128) b.Run("size=144", benchmarkMallocgcScanSlice144) b.Run("size=160", benchmarkMallocgcScanSlice160) b.Run("size=176", benchmarkMallocgcScanSlice176) b.Run("size=192", benchmarkMallocgcScanSlice192) b.Run("size=208", benchmarkMallocgcScanSlice208) b.Run("size=224", benchmarkMallocgcScanSlice224) b.Run("size=240", benchmarkMallocgcScanSlice240) b.Run("size=256", benchmarkMallocgcScanSlice256) b.Run("size=288", benchmarkMallocgcScanSlice288) b.Run("size=320", benchmarkMallocgcScanSlice320) b.Run("size=352", benchmarkMallocgcScanSlice352) b.Run("size=384", benchmarkMallocgcScanSlice384) b.Run("size=416", benchmarkMallocgcScanSlice416) b.Run("size=448", benchmarkMallocgcScanSlice448) b.Run("size=480", benchmarkMallocgcScanSlice480) b.Run("size=512", benchmarkMallocgcScanSlice512) }) }