Source file src/runtime/malloc_bench_generated_test.go

     1  // Code generated by mkmalloc.go; DO NOT EDIT.
     2  // See overview in malloc_stubs.go.
     3  
     4  package runtime_test
     5  
     6  import (
     7  	"internal/abi"
     8  	"runtime"
     9  	"testing"
    10  )
    11  
    12  func benchmarkMallocgcNoscan8(b *testing.B) {
    13  	const size = 8
    14  	b.Run("kind=new", func(b *testing.B) {
    15  		for b.Loop() {
    16  
    17  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
    18  
    19  		}
    20  	})
    21  	var typ *abi.Type
    22  
    23  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
    24  
    25  	b.Run("kind=mallocgc", func(b *testing.B) {
    26  		for b.Loop() {
    27  			runtime.Escape(runtime.MallocGC(size, typ, true))
    28  		}
    29  	})
    30  }
    31  
    32  func benchmarkMallocgcScan8(b *testing.B) {
    33  	const size = 8
    34  	b.Run("kind=new", func(b *testing.B) {
    35  		for b.Loop() {
    36  
    37  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
    38  
    39  		}
    40  	})
    41  	var typ *abi.Type
    42  
    43  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
    44  
    45  	b.Run("kind=mallocgc", func(b *testing.B) {
    46  		for b.Loop() {
    47  			runtime.Escape(runtime.MallocGC(size, typ, true))
    48  		}
    49  	})
    50  }
    51  
    52  func benchmarkMallocgcScanSlice8(b *testing.B) {
    53  	const size = 8
    54  	for b.Loop() {
    55  		runtime.Escape(make([]*uint64, size/8))
    56  	}
    57  }
    58  
    59  func benchmarkMallocgcNoscan16(b *testing.B) {
    60  	const size = 16
    61  	b.Run("kind=new", func(b *testing.B) {
    62  		for b.Loop() {
    63  
    64  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
    65  
    66  		}
    67  	})
    68  	var typ *abi.Type
    69  
    70  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
    71  
    72  	b.Run("kind=mallocgc", func(b *testing.B) {
    73  		for b.Loop() {
    74  			runtime.Escape(runtime.MallocGC(size, typ, true))
    75  		}
    76  	})
    77  }
    78  
    79  func benchmarkMallocgcScan16(b *testing.B) {
    80  	const size = 16
    81  	b.Run("kind=new", func(b *testing.B) {
    82  		for b.Loop() {
    83  
    84  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
    85  
    86  		}
    87  	})
    88  	var typ *abi.Type
    89  
    90  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
    91  
    92  	b.Run("kind=mallocgc", func(b *testing.B) {
    93  		for b.Loop() {
    94  			runtime.Escape(runtime.MallocGC(size, typ, true))
    95  		}
    96  	})
    97  }
    98  
    99  func benchmarkMallocgcScanSlice16(b *testing.B) {
   100  	const size = 16
   101  	for b.Loop() {
   102  		runtime.Escape(make([]*uint64, size/8))
   103  	}
   104  }
   105  
   106  func benchmarkMallocgcNoscan24(b *testing.B) {
   107  	const size = 24
   108  	b.Run("kind=new", func(b *testing.B) {
   109  		for b.Loop() {
   110  
   111  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   112  
   113  		}
   114  	})
   115  	var typ *abi.Type
   116  
   117  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   118  
   119  	b.Run("kind=mallocgc", func(b *testing.B) {
   120  		for b.Loop() {
   121  			runtime.Escape(runtime.MallocGC(size, typ, true))
   122  		}
   123  	})
   124  }
   125  
   126  func benchmarkMallocgcScan24(b *testing.B) {
   127  	const size = 24
   128  	b.Run("kind=new", func(b *testing.B) {
   129  		for b.Loop() {
   130  
   131  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   132  
   133  		}
   134  	})
   135  	var typ *abi.Type
   136  
   137  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   138  
   139  	b.Run("kind=mallocgc", func(b *testing.B) {
   140  		for b.Loop() {
   141  			runtime.Escape(runtime.MallocGC(size, typ, true))
   142  		}
   143  	})
   144  }
   145  
   146  func benchmarkMallocgcScanSlice24(b *testing.B) {
   147  	const size = 24
   148  	for b.Loop() {
   149  		runtime.Escape(make([]*uint64, size/8))
   150  	}
   151  }
   152  
   153  func benchmarkMallocgcNoscan32(b *testing.B) {
   154  	const size = 32
   155  	b.Run("kind=new", func(b *testing.B) {
   156  		for b.Loop() {
   157  
   158  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   159  
   160  		}
   161  	})
   162  	var typ *abi.Type
   163  
   164  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   165  
   166  	b.Run("kind=mallocgc", func(b *testing.B) {
   167  		for b.Loop() {
   168  			runtime.Escape(runtime.MallocGC(size, typ, true))
   169  		}
   170  	})
   171  }
   172  
   173  func benchmarkMallocgcScan32(b *testing.B) {
   174  	const size = 32
   175  	b.Run("kind=new", func(b *testing.B) {
   176  		for b.Loop() {
   177  
   178  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   179  
   180  		}
   181  	})
   182  	var typ *abi.Type
   183  
   184  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   185  
   186  	b.Run("kind=mallocgc", func(b *testing.B) {
   187  		for b.Loop() {
   188  			runtime.Escape(runtime.MallocGC(size, typ, true))
   189  		}
   190  	})
   191  }
   192  
   193  func benchmarkMallocgcScanSlice32(b *testing.B) {
   194  	const size = 32
   195  	for b.Loop() {
   196  		runtime.Escape(make([]*uint64, size/8))
   197  	}
   198  }
   199  
   200  func benchmarkMallocgcNoscan48(b *testing.B) {
   201  	const size = 48
   202  	b.Run("kind=new", func(b *testing.B) {
   203  		for b.Loop() {
   204  
   205  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   206  
   207  		}
   208  	})
   209  	var typ *abi.Type
   210  
   211  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   212  
   213  	b.Run("kind=mallocgc", func(b *testing.B) {
   214  		for b.Loop() {
   215  			runtime.Escape(runtime.MallocGC(size, typ, true))
   216  		}
   217  	})
   218  }
   219  
   220  func benchmarkMallocgcScan48(b *testing.B) {
   221  	const size = 48
   222  	b.Run("kind=new", func(b *testing.B) {
   223  		for b.Loop() {
   224  
   225  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   226  
   227  		}
   228  	})
   229  	var typ *abi.Type
   230  
   231  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   232  
   233  	b.Run("kind=mallocgc", func(b *testing.B) {
   234  		for b.Loop() {
   235  			runtime.Escape(runtime.MallocGC(size, typ, true))
   236  		}
   237  	})
   238  }
   239  
   240  func benchmarkMallocgcScanSlice48(b *testing.B) {
   241  	const size = 48
   242  	for b.Loop() {
   243  		runtime.Escape(make([]*uint64, size/8))
   244  	}
   245  }
   246  
   247  func benchmarkMallocgcNoscan64(b *testing.B) {
   248  	const size = 64
   249  	b.Run("kind=new", func(b *testing.B) {
   250  		for b.Loop() {
   251  
   252  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   253  
   254  		}
   255  	})
   256  	var typ *abi.Type
   257  
   258  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   259  
   260  	b.Run("kind=mallocgc", func(b *testing.B) {
   261  		for b.Loop() {
   262  			runtime.Escape(runtime.MallocGC(size, typ, true))
   263  		}
   264  	})
   265  }
   266  
   267  func benchmarkMallocgcScan64(b *testing.B) {
   268  	const size = 64
   269  	b.Run("kind=new", func(b *testing.B) {
   270  		for b.Loop() {
   271  
   272  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   273  
   274  		}
   275  	})
   276  	var typ *abi.Type
   277  
   278  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   279  
   280  	b.Run("kind=mallocgc", func(b *testing.B) {
   281  		for b.Loop() {
   282  			runtime.Escape(runtime.MallocGC(size, typ, true))
   283  		}
   284  	})
   285  }
   286  
   287  func benchmarkMallocgcScanSlice64(b *testing.B) {
   288  	const size = 64
   289  	for b.Loop() {
   290  		runtime.Escape(make([]*uint64, size/8))
   291  	}
   292  }
   293  
   294  func benchmarkMallocgcNoscan80(b *testing.B) {
   295  	const size = 80
   296  	b.Run("kind=new", func(b *testing.B) {
   297  		for b.Loop() {
   298  
   299  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   300  
   301  		}
   302  	})
   303  	var typ *abi.Type
   304  
   305  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   306  
   307  	b.Run("kind=mallocgc", func(b *testing.B) {
   308  		for b.Loop() {
   309  			runtime.Escape(runtime.MallocGC(size, typ, true))
   310  		}
   311  	})
   312  }
   313  
   314  func benchmarkMallocgcScan80(b *testing.B) {
   315  	const size = 80
   316  	b.Run("kind=new", func(b *testing.B) {
   317  		for b.Loop() {
   318  
   319  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   320  
   321  		}
   322  	})
   323  	var typ *abi.Type
   324  
   325  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   326  
   327  	b.Run("kind=mallocgc", func(b *testing.B) {
   328  		for b.Loop() {
   329  			runtime.Escape(runtime.MallocGC(size, typ, true))
   330  		}
   331  	})
   332  }
   333  
   334  func benchmarkMallocgcScanSlice80(b *testing.B) {
   335  	const size = 80
   336  	for b.Loop() {
   337  		runtime.Escape(make([]*uint64, size/8))
   338  	}
   339  }
   340  
   341  func benchmarkMallocgcNoscan96(b *testing.B) {
   342  	const size = 96
   343  	b.Run("kind=new", func(b *testing.B) {
   344  		for b.Loop() {
   345  
   346  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   347  
   348  		}
   349  	})
   350  	var typ *abi.Type
   351  
   352  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   353  
   354  	b.Run("kind=mallocgc", func(b *testing.B) {
   355  		for b.Loop() {
   356  			runtime.Escape(runtime.MallocGC(size, typ, true))
   357  		}
   358  	})
   359  }
   360  
   361  func benchmarkMallocgcScan96(b *testing.B) {
   362  	const size = 96
   363  	b.Run("kind=new", func(b *testing.B) {
   364  		for b.Loop() {
   365  
   366  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   367  
   368  		}
   369  	})
   370  	var typ *abi.Type
   371  
   372  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   373  
   374  	b.Run("kind=mallocgc", func(b *testing.B) {
   375  		for b.Loop() {
   376  			runtime.Escape(runtime.MallocGC(size, typ, true))
   377  		}
   378  	})
   379  }
   380  
   381  func benchmarkMallocgcScanSlice96(b *testing.B) {
   382  	const size = 96
   383  	for b.Loop() {
   384  		runtime.Escape(make([]*uint64, size/8))
   385  	}
   386  }
   387  
   388  func benchmarkMallocgcNoscan112(b *testing.B) {
   389  	const size = 112
   390  	b.Run("kind=new", func(b *testing.B) {
   391  		for b.Loop() {
   392  
   393  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   394  
   395  		}
   396  	})
   397  	var typ *abi.Type
   398  
   399  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   400  
   401  	b.Run("kind=mallocgc", func(b *testing.B) {
   402  		for b.Loop() {
   403  			runtime.Escape(runtime.MallocGC(size, typ, true))
   404  		}
   405  	})
   406  }
   407  
   408  func benchmarkMallocgcScan112(b *testing.B) {
   409  	const size = 112
   410  	b.Run("kind=new", func(b *testing.B) {
   411  		for b.Loop() {
   412  
   413  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   414  
   415  		}
   416  	})
   417  	var typ *abi.Type
   418  
   419  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   420  
   421  	b.Run("kind=mallocgc", func(b *testing.B) {
   422  		for b.Loop() {
   423  			runtime.Escape(runtime.MallocGC(size, typ, true))
   424  		}
   425  	})
   426  }
   427  
   428  func benchmarkMallocgcScanSlice112(b *testing.B) {
   429  	const size = 112
   430  	for b.Loop() {
   431  		runtime.Escape(make([]*uint64, size/8))
   432  	}
   433  }
   434  
   435  func benchmarkMallocgcNoscan128(b *testing.B) {
   436  	const size = 128
   437  	b.Run("kind=new", func(b *testing.B) {
   438  		for b.Loop() {
   439  
   440  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   441  
   442  		}
   443  	})
   444  	var typ *abi.Type
   445  
   446  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   447  
   448  	b.Run("kind=mallocgc", func(b *testing.B) {
   449  		for b.Loop() {
   450  			runtime.Escape(runtime.MallocGC(size, typ, true))
   451  		}
   452  	})
   453  }
   454  
   455  func benchmarkMallocgcScan128(b *testing.B) {
   456  	const size = 128
   457  	b.Run("kind=new", func(b *testing.B) {
   458  		for b.Loop() {
   459  
   460  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   461  
   462  		}
   463  	})
   464  	var typ *abi.Type
   465  
   466  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   467  
   468  	b.Run("kind=mallocgc", func(b *testing.B) {
   469  		for b.Loop() {
   470  			runtime.Escape(runtime.MallocGC(size, typ, true))
   471  		}
   472  	})
   473  }
   474  
   475  func benchmarkMallocgcScanSlice128(b *testing.B) {
   476  	const size = 128
   477  	for b.Loop() {
   478  		runtime.Escape(make([]*uint64, size/8))
   479  	}
   480  }
   481  
   482  func benchmarkMallocgcNoscan144(b *testing.B) {
   483  	const size = 144
   484  	b.Run("kind=new", func(b *testing.B) {
   485  		for b.Loop() {
   486  
   487  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   488  
   489  		}
   490  	})
   491  	var typ *abi.Type
   492  
   493  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   494  
   495  	b.Run("kind=mallocgc", func(b *testing.B) {
   496  		for b.Loop() {
   497  			runtime.Escape(runtime.MallocGC(size, typ, true))
   498  		}
   499  	})
   500  }
   501  
   502  func benchmarkMallocgcScan144(b *testing.B) {
   503  	const size = 144
   504  	b.Run("kind=new", func(b *testing.B) {
   505  		for b.Loop() {
   506  
   507  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   508  
   509  		}
   510  	})
   511  	var typ *abi.Type
   512  
   513  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   514  
   515  	b.Run("kind=mallocgc", func(b *testing.B) {
   516  		for b.Loop() {
   517  			runtime.Escape(runtime.MallocGC(size, typ, true))
   518  		}
   519  	})
   520  }
   521  
   522  func benchmarkMallocgcScanSlice144(b *testing.B) {
   523  	const size = 144
   524  	for b.Loop() {
   525  		runtime.Escape(make([]*uint64, size/8))
   526  	}
   527  }
   528  
   529  func benchmarkMallocgcNoscan160(b *testing.B) {
   530  	const size = 160
   531  	b.Run("kind=new", func(b *testing.B) {
   532  		for b.Loop() {
   533  
   534  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   535  
   536  		}
   537  	})
   538  	var typ *abi.Type
   539  
   540  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   541  
   542  	b.Run("kind=mallocgc", func(b *testing.B) {
   543  		for b.Loop() {
   544  			runtime.Escape(runtime.MallocGC(size, typ, true))
   545  		}
   546  	})
   547  }
   548  
   549  func benchmarkMallocgcScan160(b *testing.B) {
   550  	const size = 160
   551  	b.Run("kind=new", func(b *testing.B) {
   552  		for b.Loop() {
   553  
   554  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   555  
   556  		}
   557  	})
   558  	var typ *abi.Type
   559  
   560  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   561  
   562  	b.Run("kind=mallocgc", func(b *testing.B) {
   563  		for b.Loop() {
   564  			runtime.Escape(runtime.MallocGC(size, typ, true))
   565  		}
   566  	})
   567  }
   568  
   569  func benchmarkMallocgcScanSlice160(b *testing.B) {
   570  	const size = 160
   571  	for b.Loop() {
   572  		runtime.Escape(make([]*uint64, size/8))
   573  	}
   574  }
   575  
   576  func benchmarkMallocgcNoscan176(b *testing.B) {
   577  	const size = 176
   578  	b.Run("kind=new", func(b *testing.B) {
   579  		for b.Loop() {
   580  
   581  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   582  
   583  		}
   584  	})
   585  	var typ *abi.Type
   586  
   587  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   588  
   589  	b.Run("kind=mallocgc", func(b *testing.B) {
   590  		for b.Loop() {
   591  			runtime.Escape(runtime.MallocGC(size, typ, true))
   592  		}
   593  	})
   594  }
   595  
   596  func benchmarkMallocgcScan176(b *testing.B) {
   597  	const size = 176
   598  	b.Run("kind=new", func(b *testing.B) {
   599  		for b.Loop() {
   600  
   601  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   602  
   603  		}
   604  	})
   605  	var typ *abi.Type
   606  
   607  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   608  
   609  	b.Run("kind=mallocgc", func(b *testing.B) {
   610  		for b.Loop() {
   611  			runtime.Escape(runtime.MallocGC(size, typ, true))
   612  		}
   613  	})
   614  }
   615  
   616  func benchmarkMallocgcScanSlice176(b *testing.B) {
   617  	const size = 176
   618  	for b.Loop() {
   619  		runtime.Escape(make([]*uint64, size/8))
   620  	}
   621  }
   622  
   623  func benchmarkMallocgcNoscan192(b *testing.B) {
   624  	const size = 192
   625  	b.Run("kind=new", func(b *testing.B) {
   626  		for b.Loop() {
   627  
   628  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   629  
   630  		}
   631  	})
   632  	var typ *abi.Type
   633  
   634  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   635  
   636  	b.Run("kind=mallocgc", func(b *testing.B) {
   637  		for b.Loop() {
   638  			runtime.Escape(runtime.MallocGC(size, typ, true))
   639  		}
   640  	})
   641  }
   642  
   643  func benchmarkMallocgcScan192(b *testing.B) {
   644  	const size = 192
   645  	b.Run("kind=new", func(b *testing.B) {
   646  		for b.Loop() {
   647  
   648  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   649  
   650  		}
   651  	})
   652  	var typ *abi.Type
   653  
   654  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   655  
   656  	b.Run("kind=mallocgc", func(b *testing.B) {
   657  		for b.Loop() {
   658  			runtime.Escape(runtime.MallocGC(size, typ, true))
   659  		}
   660  	})
   661  }
   662  
   663  func benchmarkMallocgcScanSlice192(b *testing.B) {
   664  	const size = 192
   665  	for b.Loop() {
   666  		runtime.Escape(make([]*uint64, size/8))
   667  	}
   668  }
   669  
   670  func benchmarkMallocgcNoscan208(b *testing.B) {
   671  	const size = 208
   672  	b.Run("kind=new", func(b *testing.B) {
   673  		for b.Loop() {
   674  
   675  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   676  
   677  		}
   678  	})
   679  	var typ *abi.Type
   680  
   681  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   682  
   683  	b.Run("kind=mallocgc", func(b *testing.B) {
   684  		for b.Loop() {
   685  			runtime.Escape(runtime.MallocGC(size, typ, true))
   686  		}
   687  	})
   688  }
   689  
   690  func benchmarkMallocgcScan208(b *testing.B) {
   691  	const size = 208
   692  	b.Run("kind=new", func(b *testing.B) {
   693  		for b.Loop() {
   694  
   695  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   696  
   697  		}
   698  	})
   699  	var typ *abi.Type
   700  
   701  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   702  
   703  	b.Run("kind=mallocgc", func(b *testing.B) {
   704  		for b.Loop() {
   705  			runtime.Escape(runtime.MallocGC(size, typ, true))
   706  		}
   707  	})
   708  }
   709  
   710  func benchmarkMallocgcScanSlice208(b *testing.B) {
   711  	const size = 208
   712  	for b.Loop() {
   713  		runtime.Escape(make([]*uint64, size/8))
   714  	}
   715  }
   716  
   717  func benchmarkMallocgcNoscan224(b *testing.B) {
   718  	const size = 224
   719  	b.Run("kind=new", func(b *testing.B) {
   720  		for b.Loop() {
   721  
   722  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   723  
   724  		}
   725  	})
   726  	var typ *abi.Type
   727  
   728  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   729  
   730  	b.Run("kind=mallocgc", func(b *testing.B) {
   731  		for b.Loop() {
   732  			runtime.Escape(runtime.MallocGC(size, typ, true))
   733  		}
   734  	})
   735  }
   736  
   737  func benchmarkMallocgcScan224(b *testing.B) {
   738  	const size = 224
   739  	b.Run("kind=new", func(b *testing.B) {
   740  		for b.Loop() {
   741  
   742  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   743  
   744  		}
   745  	})
   746  	var typ *abi.Type
   747  
   748  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   749  
   750  	b.Run("kind=mallocgc", func(b *testing.B) {
   751  		for b.Loop() {
   752  			runtime.Escape(runtime.MallocGC(size, typ, true))
   753  		}
   754  	})
   755  }
   756  
   757  func benchmarkMallocgcScanSlice224(b *testing.B) {
   758  	const size = 224
   759  	for b.Loop() {
   760  		runtime.Escape(make([]*uint64, size/8))
   761  	}
   762  }
   763  
   764  func benchmarkMallocgcNoscan240(b *testing.B) {
   765  	const size = 240
   766  	b.Run("kind=new", func(b *testing.B) {
   767  		for b.Loop() {
   768  
   769  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   770  
   771  		}
   772  	})
   773  	var typ *abi.Type
   774  
   775  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   776  
   777  	b.Run("kind=mallocgc", func(b *testing.B) {
   778  		for b.Loop() {
   779  			runtime.Escape(runtime.MallocGC(size, typ, true))
   780  		}
   781  	})
   782  }
   783  
   784  func benchmarkMallocgcScan240(b *testing.B) {
   785  	const size = 240
   786  	b.Run("kind=new", func(b *testing.B) {
   787  		for b.Loop() {
   788  
   789  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   790  
   791  		}
   792  	})
   793  	var typ *abi.Type
   794  
   795  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   796  
   797  	b.Run("kind=mallocgc", func(b *testing.B) {
   798  		for b.Loop() {
   799  			runtime.Escape(runtime.MallocGC(size, typ, true))
   800  		}
   801  	})
   802  }
   803  
   804  func benchmarkMallocgcScanSlice240(b *testing.B) {
   805  	const size = 240
   806  	for b.Loop() {
   807  		runtime.Escape(make([]*uint64, size/8))
   808  	}
   809  }
   810  
   811  func benchmarkMallocgcNoscan256(b *testing.B) {
   812  	const size = 256
   813  	b.Run("kind=new", func(b *testing.B) {
   814  		for b.Loop() {
   815  
   816  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   817  
   818  		}
   819  	})
   820  	var typ *abi.Type
   821  
   822  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   823  
   824  	b.Run("kind=mallocgc", func(b *testing.B) {
   825  		for b.Loop() {
   826  			runtime.Escape(runtime.MallocGC(size, typ, true))
   827  		}
   828  	})
   829  }
   830  
   831  func benchmarkMallocgcScan256(b *testing.B) {
   832  	const size = 256
   833  	b.Run("kind=new", func(b *testing.B) {
   834  		for b.Loop() {
   835  
   836  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   837  
   838  		}
   839  	})
   840  	var typ *abi.Type
   841  
   842  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   843  
   844  	b.Run("kind=mallocgc", func(b *testing.B) {
   845  		for b.Loop() {
   846  			runtime.Escape(runtime.MallocGC(size, typ, true))
   847  		}
   848  	})
   849  }
   850  
   851  func benchmarkMallocgcScanSlice256(b *testing.B) {
   852  	const size = 256
   853  	for b.Loop() {
   854  		runtime.Escape(make([]*uint64, size/8))
   855  	}
   856  }
   857  
   858  func benchmarkMallocgcNoscan288(b *testing.B) {
   859  	const size = 288
   860  	b.Run("kind=new", func(b *testing.B) {
   861  		for b.Loop() {
   862  
   863  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   864  
   865  		}
   866  	})
   867  	var typ *abi.Type
   868  
   869  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   870  
   871  	b.Run("kind=mallocgc", func(b *testing.B) {
   872  		for b.Loop() {
   873  			runtime.Escape(runtime.MallocGC(size, typ, true))
   874  		}
   875  	})
   876  }
   877  
   878  func benchmarkMallocgcScan288(b *testing.B) {
   879  	const size = 288
   880  	b.Run("kind=new", func(b *testing.B) {
   881  		for b.Loop() {
   882  
   883  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   884  
   885  		}
   886  	})
   887  	var typ *abi.Type
   888  
   889  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   890  
   891  	b.Run("kind=mallocgc", func(b *testing.B) {
   892  		for b.Loop() {
   893  			runtime.Escape(runtime.MallocGC(size, typ, true))
   894  		}
   895  	})
   896  }
   897  
   898  func benchmarkMallocgcScanSlice288(b *testing.B) {
   899  	const size = 288
   900  	for b.Loop() {
   901  		runtime.Escape(make([]*uint64, size/8))
   902  	}
   903  }
   904  
   905  func benchmarkMallocgcNoscan320(b *testing.B) {
   906  	const size = 320
   907  	b.Run("kind=new", func(b *testing.B) {
   908  		for b.Loop() {
   909  
   910  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   911  
   912  		}
   913  	})
   914  	var typ *abi.Type
   915  
   916  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   917  
   918  	b.Run("kind=mallocgc", func(b *testing.B) {
   919  		for b.Loop() {
   920  			runtime.Escape(runtime.MallocGC(size, typ, true))
   921  		}
   922  	})
   923  }
   924  
   925  func benchmarkMallocgcScan320(b *testing.B) {
   926  	const size = 320
   927  	b.Run("kind=new", func(b *testing.B) {
   928  		for b.Loop() {
   929  
   930  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   931  
   932  		}
   933  	})
   934  	var typ *abi.Type
   935  
   936  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   937  
   938  	b.Run("kind=mallocgc", func(b *testing.B) {
   939  		for b.Loop() {
   940  			runtime.Escape(runtime.MallocGC(size, typ, true))
   941  		}
   942  	})
   943  }
   944  
   945  func benchmarkMallocgcScanSlice320(b *testing.B) {
   946  	const size = 320
   947  	for b.Loop() {
   948  		runtime.Escape(make([]*uint64, size/8))
   949  	}
   950  }
   951  
   952  func benchmarkMallocgcNoscan352(b *testing.B) {
   953  	const size = 352
   954  	b.Run("kind=new", func(b *testing.B) {
   955  		for b.Loop() {
   956  
   957  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
   958  
   959  		}
   960  	})
   961  	var typ *abi.Type
   962  
   963  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
   964  
   965  	b.Run("kind=mallocgc", func(b *testing.B) {
   966  		for b.Loop() {
   967  			runtime.Escape(runtime.MallocGC(size, typ, true))
   968  		}
   969  	})
   970  }
   971  
   972  func benchmarkMallocgcScan352(b *testing.B) {
   973  	const size = 352
   974  	b.Run("kind=new", func(b *testing.B) {
   975  		for b.Loop() {
   976  
   977  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
   978  
   979  		}
   980  	})
   981  	var typ *abi.Type
   982  
   983  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
   984  
   985  	b.Run("kind=mallocgc", func(b *testing.B) {
   986  		for b.Loop() {
   987  			runtime.Escape(runtime.MallocGC(size, typ, true))
   988  		}
   989  	})
   990  }
   991  
   992  func benchmarkMallocgcScanSlice352(b *testing.B) {
   993  	const size = 352
   994  	for b.Loop() {
   995  		runtime.Escape(make([]*uint64, size/8))
   996  	}
   997  }
   998  
   999  func benchmarkMallocgcNoscan384(b *testing.B) {
  1000  	const size = 384
  1001  	b.Run("kind=new", func(b *testing.B) {
  1002  		for b.Loop() {
  1003  
  1004  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
  1005  
  1006  		}
  1007  	})
  1008  	var typ *abi.Type
  1009  
  1010  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
  1011  
  1012  	b.Run("kind=mallocgc", func(b *testing.B) {
  1013  		for b.Loop() {
  1014  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1015  		}
  1016  	})
  1017  }
  1018  
  1019  func benchmarkMallocgcScan384(b *testing.B) {
  1020  	const size = 384
  1021  	b.Run("kind=new", func(b *testing.B) {
  1022  		for b.Loop() {
  1023  
  1024  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
  1025  
  1026  		}
  1027  	})
  1028  	var typ *abi.Type
  1029  
  1030  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
  1031  
  1032  	b.Run("kind=mallocgc", func(b *testing.B) {
  1033  		for b.Loop() {
  1034  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1035  		}
  1036  	})
  1037  }
  1038  
  1039  func benchmarkMallocgcScanSlice384(b *testing.B) {
  1040  	const size = 384
  1041  	for b.Loop() {
  1042  		runtime.Escape(make([]*uint64, size/8))
  1043  	}
  1044  }
  1045  
  1046  func benchmarkMallocgcNoscan416(b *testing.B) {
  1047  	const size = 416
  1048  	b.Run("kind=new", func(b *testing.B) {
  1049  		for b.Loop() {
  1050  
  1051  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
  1052  
  1053  		}
  1054  	})
  1055  	var typ *abi.Type
  1056  
  1057  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
  1058  
  1059  	b.Run("kind=mallocgc", func(b *testing.B) {
  1060  		for b.Loop() {
  1061  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1062  		}
  1063  	})
  1064  }
  1065  
  1066  func benchmarkMallocgcScan416(b *testing.B) {
  1067  	const size = 416
  1068  	b.Run("kind=new", func(b *testing.B) {
  1069  		for b.Loop() {
  1070  
  1071  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
  1072  
  1073  		}
  1074  	})
  1075  	var typ *abi.Type
  1076  
  1077  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
  1078  
  1079  	b.Run("kind=mallocgc", func(b *testing.B) {
  1080  		for b.Loop() {
  1081  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1082  		}
  1083  	})
  1084  }
  1085  
  1086  func benchmarkMallocgcScanSlice416(b *testing.B) {
  1087  	const size = 416
  1088  	for b.Loop() {
  1089  		runtime.Escape(make([]*uint64, size/8))
  1090  	}
  1091  }
  1092  
  1093  func benchmarkMallocgcNoscan448(b *testing.B) {
  1094  	const size = 448
  1095  	b.Run("kind=new", func(b *testing.B) {
  1096  		for b.Loop() {
  1097  
  1098  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
  1099  
  1100  		}
  1101  	})
  1102  	var typ *abi.Type
  1103  
  1104  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
  1105  
  1106  	b.Run("kind=mallocgc", func(b *testing.B) {
  1107  		for b.Loop() {
  1108  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1109  		}
  1110  	})
  1111  }
  1112  
  1113  func benchmarkMallocgcScan448(b *testing.B) {
  1114  	const size = 448
  1115  	b.Run("kind=new", func(b *testing.B) {
  1116  		for b.Loop() {
  1117  
  1118  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
  1119  
  1120  		}
  1121  	})
  1122  	var typ *abi.Type
  1123  
  1124  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
  1125  
  1126  	b.Run("kind=mallocgc", func(b *testing.B) {
  1127  		for b.Loop() {
  1128  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1129  		}
  1130  	})
  1131  }
  1132  
  1133  func benchmarkMallocgcScanSlice448(b *testing.B) {
  1134  	const size = 448
  1135  	for b.Loop() {
  1136  		runtime.Escape(make([]*uint64, size/8))
  1137  	}
  1138  }
  1139  
  1140  func benchmarkMallocgcNoscan480(b *testing.B) {
  1141  	const size = 480
  1142  	b.Run("kind=new", func(b *testing.B) {
  1143  		for b.Loop() {
  1144  
  1145  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
  1146  
  1147  		}
  1148  	})
  1149  	var typ *abi.Type
  1150  
  1151  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
  1152  
  1153  	b.Run("kind=mallocgc", func(b *testing.B) {
  1154  		for b.Loop() {
  1155  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1156  		}
  1157  	})
  1158  }
  1159  
  1160  func benchmarkMallocgcScan480(b *testing.B) {
  1161  	const size = 480
  1162  	b.Run("kind=new", func(b *testing.B) {
  1163  		for b.Loop() {
  1164  
  1165  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
  1166  
  1167  		}
  1168  	})
  1169  	var typ *abi.Type
  1170  
  1171  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
  1172  
  1173  	b.Run("kind=mallocgc", func(b *testing.B) {
  1174  		for b.Loop() {
  1175  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1176  		}
  1177  	})
  1178  }
  1179  
  1180  func benchmarkMallocgcScanSlice480(b *testing.B) {
  1181  	const size = 480
  1182  	for b.Loop() {
  1183  		runtime.Escape(make([]*uint64, size/8))
  1184  	}
  1185  }
  1186  
  1187  func benchmarkMallocgcNoscan512(b *testing.B) {
  1188  	const size = 512
  1189  	b.Run("kind=new", func(b *testing.B) {
  1190  		for b.Loop() {
  1191  
  1192  			runtime.Escape(new(struct{ v [size / 8]uint64 }))
  1193  
  1194  		}
  1195  	})
  1196  	var typ *abi.Type
  1197  
  1198  	typ = abi.TypeOf(struct{ v [size / 8]uint64 }{})
  1199  
  1200  	b.Run("kind=mallocgc", func(b *testing.B) {
  1201  		for b.Loop() {
  1202  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1203  		}
  1204  	})
  1205  }
  1206  
  1207  func benchmarkMallocgcScan512(b *testing.B) {
  1208  	const size = 512
  1209  	b.Run("kind=new", func(b *testing.B) {
  1210  		for b.Loop() {
  1211  
  1212  			runtime.Escape(new(struct{ v [size / 8]*uint64 }))
  1213  
  1214  		}
  1215  	})
  1216  	var typ *abi.Type
  1217  
  1218  	typ = abi.TypeOf(struct{ v [size / 8]*uint64 }{})
  1219  
  1220  	b.Run("kind=mallocgc", func(b *testing.B) {
  1221  		for b.Loop() {
  1222  			runtime.Escape(runtime.MallocGC(size, typ, true))
  1223  		}
  1224  	})
  1225  }
  1226  
  1227  func benchmarkMallocgcScanSlice512(b *testing.B) {
  1228  	const size = 512
  1229  	for b.Loop() {
  1230  		runtime.Escape(make([]*uint64, size/8))
  1231  	}
  1232  }
  1233  
  1234  func benchmarkMallocgcTiny1(b *testing.B) {
  1235  	const size = 1
  1236  	type s struct {
  1237  		v [size]byte
  1238  	}
  1239  	b.Run("kind=new", func(b *testing.B) {
  1240  		for b.Loop() {
  1241  			runtime.Escape(new(s))
  1242  		}
  1243  	})
  1244  	typ := abi.TypeOf(s{})
  1245  	b.Run("kind=mallocgc", func(b *testing.B) {
  1246  		for b.Loop() {
  1247  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1248  		}
  1249  	})
  1250  }
  1251  
  1252  func benchmarkMallocgcTiny2(b *testing.B) {
  1253  	const size = 2
  1254  	type s struct {
  1255  		v [size]byte
  1256  	}
  1257  	b.Run("kind=new", func(b *testing.B) {
  1258  		for b.Loop() {
  1259  			runtime.Escape(new(s))
  1260  		}
  1261  	})
  1262  	typ := abi.TypeOf(s{})
  1263  	b.Run("kind=mallocgc", func(b *testing.B) {
  1264  		for b.Loop() {
  1265  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1266  		}
  1267  	})
  1268  }
  1269  
  1270  func benchmarkMallocgcTiny3(b *testing.B) {
  1271  	const size = 3
  1272  	type s struct {
  1273  		v [size]byte
  1274  	}
  1275  	b.Run("kind=new", func(b *testing.B) {
  1276  		for b.Loop() {
  1277  			runtime.Escape(new(s))
  1278  		}
  1279  	})
  1280  	typ := abi.TypeOf(s{})
  1281  	b.Run("kind=mallocgc", func(b *testing.B) {
  1282  		for b.Loop() {
  1283  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1284  		}
  1285  	})
  1286  }
  1287  
  1288  func benchmarkMallocgcTiny4(b *testing.B) {
  1289  	const size = 4
  1290  	type s struct {
  1291  		v [size]byte
  1292  	}
  1293  	b.Run("kind=new", func(b *testing.B) {
  1294  		for b.Loop() {
  1295  			runtime.Escape(new(s))
  1296  		}
  1297  	})
  1298  	typ := abi.TypeOf(s{})
  1299  	b.Run("kind=mallocgc", func(b *testing.B) {
  1300  		for b.Loop() {
  1301  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1302  		}
  1303  	})
  1304  }
  1305  
  1306  func benchmarkMallocgcTiny5(b *testing.B) {
  1307  	const size = 5
  1308  	type s struct {
  1309  		v [size]byte
  1310  	}
  1311  	b.Run("kind=new", func(b *testing.B) {
  1312  		for b.Loop() {
  1313  			runtime.Escape(new(s))
  1314  		}
  1315  	})
  1316  	typ := abi.TypeOf(s{})
  1317  	b.Run("kind=mallocgc", func(b *testing.B) {
  1318  		for b.Loop() {
  1319  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1320  		}
  1321  	})
  1322  }
  1323  
  1324  func benchmarkMallocgcTiny6(b *testing.B) {
  1325  	const size = 6
  1326  	type s struct {
  1327  		v [size]byte
  1328  	}
  1329  	b.Run("kind=new", func(b *testing.B) {
  1330  		for b.Loop() {
  1331  			runtime.Escape(new(s))
  1332  		}
  1333  	})
  1334  	typ := abi.TypeOf(s{})
  1335  	b.Run("kind=mallocgc", func(b *testing.B) {
  1336  		for b.Loop() {
  1337  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1338  		}
  1339  	})
  1340  }
  1341  
  1342  func benchmarkMallocgcTiny7(b *testing.B) {
  1343  	const size = 7
  1344  	type s struct {
  1345  		v [size]byte
  1346  	}
  1347  	b.Run("kind=new", func(b *testing.B) {
  1348  		for b.Loop() {
  1349  			runtime.Escape(new(s))
  1350  		}
  1351  	})
  1352  	typ := abi.TypeOf(s{})
  1353  	b.Run("kind=mallocgc", func(b *testing.B) {
  1354  		for b.Loop() {
  1355  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1356  		}
  1357  	})
  1358  }
  1359  
  1360  func benchmarkMallocgcTiny8(b *testing.B) {
  1361  	const size = 8
  1362  	type s struct {
  1363  		v [size]byte
  1364  	}
  1365  	b.Run("kind=new", func(b *testing.B) {
  1366  		for b.Loop() {
  1367  			runtime.Escape(new(s))
  1368  		}
  1369  	})
  1370  	typ := abi.TypeOf(s{})
  1371  	b.Run("kind=mallocgc", func(b *testing.B) {
  1372  		for b.Loop() {
  1373  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1374  		}
  1375  	})
  1376  }
  1377  
  1378  func benchmarkMallocgcTiny9(b *testing.B) {
  1379  	const size = 9
  1380  	type s struct {
  1381  		v [size]byte
  1382  	}
  1383  	b.Run("kind=new", func(b *testing.B) {
  1384  		for b.Loop() {
  1385  			runtime.Escape(new(s))
  1386  		}
  1387  	})
  1388  	typ := abi.TypeOf(s{})
  1389  	b.Run("kind=mallocgc", func(b *testing.B) {
  1390  		for b.Loop() {
  1391  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1392  		}
  1393  	})
  1394  }
  1395  
  1396  func benchmarkMallocgcTiny10(b *testing.B) {
  1397  	const size = 10
  1398  	type s struct {
  1399  		v [size]byte
  1400  	}
  1401  	b.Run("kind=new", func(b *testing.B) {
  1402  		for b.Loop() {
  1403  			runtime.Escape(new(s))
  1404  		}
  1405  	})
  1406  	typ := abi.TypeOf(s{})
  1407  	b.Run("kind=mallocgc", func(b *testing.B) {
  1408  		for b.Loop() {
  1409  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1410  		}
  1411  	})
  1412  }
  1413  
  1414  func benchmarkMallocgcTiny11(b *testing.B) {
  1415  	const size = 11
  1416  	type s struct {
  1417  		v [size]byte
  1418  	}
  1419  	b.Run("kind=new", func(b *testing.B) {
  1420  		for b.Loop() {
  1421  			runtime.Escape(new(s))
  1422  		}
  1423  	})
  1424  	typ := abi.TypeOf(s{})
  1425  	b.Run("kind=mallocgc", func(b *testing.B) {
  1426  		for b.Loop() {
  1427  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1428  		}
  1429  	})
  1430  }
  1431  
  1432  func benchmarkMallocgcTiny12(b *testing.B) {
  1433  	const size = 12
  1434  	type s struct {
  1435  		v [size]byte
  1436  	}
  1437  	b.Run("kind=new", func(b *testing.B) {
  1438  		for b.Loop() {
  1439  			runtime.Escape(new(s))
  1440  		}
  1441  	})
  1442  	typ := abi.TypeOf(s{})
  1443  	b.Run("kind=mallocgc", func(b *testing.B) {
  1444  		for b.Loop() {
  1445  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1446  		}
  1447  	})
  1448  }
  1449  
  1450  func benchmarkMallocgcTiny13(b *testing.B) {
  1451  	const size = 13
  1452  	type s struct {
  1453  		v [size]byte
  1454  	}
  1455  	b.Run("kind=new", func(b *testing.B) {
  1456  		for b.Loop() {
  1457  			runtime.Escape(new(s))
  1458  		}
  1459  	})
  1460  	typ := abi.TypeOf(s{})
  1461  	b.Run("kind=mallocgc", func(b *testing.B) {
  1462  		for b.Loop() {
  1463  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1464  		}
  1465  	})
  1466  }
  1467  
  1468  func benchmarkMallocgcTiny14(b *testing.B) {
  1469  	const size = 14
  1470  	type s struct {
  1471  		v [size]byte
  1472  	}
  1473  	b.Run("kind=new", func(b *testing.B) {
  1474  		for b.Loop() {
  1475  			runtime.Escape(new(s))
  1476  		}
  1477  	})
  1478  	typ := abi.TypeOf(s{})
  1479  	b.Run("kind=mallocgc", func(b *testing.B) {
  1480  		for b.Loop() {
  1481  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1482  		}
  1483  	})
  1484  }
  1485  
  1486  func benchmarkMallocgcTiny15(b *testing.B) {
  1487  	const size = 15
  1488  	type s struct {
  1489  		v [size]byte
  1490  	}
  1491  	b.Run("kind=new", func(b *testing.B) {
  1492  		for b.Loop() {
  1493  			runtime.Escape(new(s))
  1494  		}
  1495  	})
  1496  	typ := abi.TypeOf(s{})
  1497  	b.Run("kind=mallocgc", func(b *testing.B) {
  1498  		for b.Loop() {
  1499  			runtime.Escape(runtime.MallocGC(size, typ, false))
  1500  		}
  1501  	})
  1502  }
  1503  
  1504  func BenchmarkMallocgc(b *testing.B) {
  1505  	b.Run("scan=noscan", func(b *testing.B) {
  1506  		b.Run("size=1", benchmarkMallocgcTiny1)
  1507  		b.Run("size=2", benchmarkMallocgcTiny2)
  1508  		b.Run("size=3", benchmarkMallocgcTiny3)
  1509  		b.Run("size=4", benchmarkMallocgcTiny4)
  1510  		b.Run("size=5", benchmarkMallocgcTiny5)
  1511  		b.Run("size=6", benchmarkMallocgcTiny6)
  1512  		b.Run("size=7", benchmarkMallocgcTiny7)
  1513  		b.Run("size=8", benchmarkMallocgcTiny8)
  1514  		b.Run("size=9", benchmarkMallocgcTiny9)
  1515  		b.Run("size=10", benchmarkMallocgcTiny10)
  1516  		b.Run("size=11", benchmarkMallocgcTiny11)
  1517  		b.Run("size=12", benchmarkMallocgcTiny12)
  1518  		b.Run("size=13", benchmarkMallocgcTiny13)
  1519  		b.Run("size=14", benchmarkMallocgcTiny14)
  1520  		b.Run("size=15", benchmarkMallocgcTiny15)
  1521  		b.Run("size=16", benchmarkMallocgcNoscan16)
  1522  		b.Run("size=24", benchmarkMallocgcNoscan24)
  1523  		b.Run("size=32", benchmarkMallocgcNoscan32)
  1524  		b.Run("size=48", benchmarkMallocgcNoscan48)
  1525  		b.Run("size=64", benchmarkMallocgcNoscan64)
  1526  		b.Run("size=80", benchmarkMallocgcNoscan80)
  1527  		b.Run("size=96", benchmarkMallocgcNoscan96)
  1528  		b.Run("size=112", benchmarkMallocgcNoscan112)
  1529  		b.Run("size=128", benchmarkMallocgcNoscan128)
  1530  		b.Run("size=144", benchmarkMallocgcNoscan144)
  1531  		b.Run("size=160", benchmarkMallocgcNoscan160)
  1532  		b.Run("size=176", benchmarkMallocgcNoscan176)
  1533  		b.Run("size=192", benchmarkMallocgcNoscan192)
  1534  		b.Run("size=208", benchmarkMallocgcNoscan208)
  1535  		b.Run("size=224", benchmarkMallocgcNoscan224)
  1536  		b.Run("size=240", benchmarkMallocgcNoscan240)
  1537  		b.Run("size=256", benchmarkMallocgcNoscan256)
  1538  		b.Run("size=288", benchmarkMallocgcNoscan288)
  1539  		b.Run("size=320", benchmarkMallocgcNoscan320)
  1540  		b.Run("size=352", benchmarkMallocgcNoscan352)
  1541  		b.Run("size=384", benchmarkMallocgcNoscan384)
  1542  		b.Run("size=416", benchmarkMallocgcNoscan416)
  1543  		b.Run("size=448", benchmarkMallocgcNoscan448)
  1544  		b.Run("size=480", benchmarkMallocgcNoscan480)
  1545  		b.Run("size=512", benchmarkMallocgcNoscan512)
  1546  	})
  1547  	b.Run("scan=scan", func(b *testing.B) {
  1548  		b.Run("size=8", benchmarkMallocgcScan8)
  1549  		b.Run("size=16", benchmarkMallocgcScan16)
  1550  		b.Run("size=24", benchmarkMallocgcScan24)
  1551  		b.Run("size=32", benchmarkMallocgcScan32)
  1552  		b.Run("size=48", benchmarkMallocgcScan48)
  1553  		b.Run("size=64", benchmarkMallocgcScan64)
  1554  		b.Run("size=80", benchmarkMallocgcScan80)
  1555  		b.Run("size=96", benchmarkMallocgcScan96)
  1556  		b.Run("size=112", benchmarkMallocgcScan112)
  1557  		b.Run("size=128", benchmarkMallocgcScan128)
  1558  		b.Run("size=144", benchmarkMallocgcScan144)
  1559  		b.Run("size=160", benchmarkMallocgcScan160)
  1560  		b.Run("size=176", benchmarkMallocgcScan176)
  1561  		b.Run("size=192", benchmarkMallocgcScan192)
  1562  		b.Run("size=208", benchmarkMallocgcScan208)
  1563  		b.Run("size=224", benchmarkMallocgcScan224)
  1564  		b.Run("size=240", benchmarkMallocgcScan240)
  1565  		b.Run("size=256", benchmarkMallocgcScan256)
  1566  		b.Run("size=288", benchmarkMallocgcScan288)
  1567  		b.Run("size=320", benchmarkMallocgcScan320)
  1568  		b.Run("size=352", benchmarkMallocgcScan352)
  1569  		b.Run("size=384", benchmarkMallocgcScan384)
  1570  		b.Run("size=416", benchmarkMallocgcScan416)
  1571  		b.Run("size=448", benchmarkMallocgcScan448)
  1572  		b.Run("size=480", benchmarkMallocgcScan480)
  1573  		b.Run("size=512", benchmarkMallocgcScan512)
  1574  	})
  1575  	b.Run("scan=scanslice", func(b *testing.B) {
  1576  		b.Run("size=8", benchmarkMallocgcScanSlice8)
  1577  		b.Run("size=16", benchmarkMallocgcScanSlice16)
  1578  		b.Run("size=24", benchmarkMallocgcScanSlice24)
  1579  		b.Run("size=32", benchmarkMallocgcScanSlice32)
  1580  		b.Run("size=48", benchmarkMallocgcScanSlice48)
  1581  		b.Run("size=64", benchmarkMallocgcScanSlice64)
  1582  		b.Run("size=80", benchmarkMallocgcScanSlice80)
  1583  		b.Run("size=96", benchmarkMallocgcScanSlice96)
  1584  		b.Run("size=112", benchmarkMallocgcScanSlice112)
  1585  		b.Run("size=128", benchmarkMallocgcScanSlice128)
  1586  		b.Run("size=144", benchmarkMallocgcScanSlice144)
  1587  		b.Run("size=160", benchmarkMallocgcScanSlice160)
  1588  		b.Run("size=176", benchmarkMallocgcScanSlice176)
  1589  		b.Run("size=192", benchmarkMallocgcScanSlice192)
  1590  		b.Run("size=208", benchmarkMallocgcScanSlice208)
  1591  		b.Run("size=224", benchmarkMallocgcScanSlice224)
  1592  		b.Run("size=240", benchmarkMallocgcScanSlice240)
  1593  		b.Run("size=256", benchmarkMallocgcScanSlice256)
  1594  		b.Run("size=288", benchmarkMallocgcScanSlice288)
  1595  		b.Run("size=320", benchmarkMallocgcScanSlice320)
  1596  		b.Run("size=352", benchmarkMallocgcScanSlice352)
  1597  		b.Run("size=384", benchmarkMallocgcScanSlice384)
  1598  		b.Run("size=416", benchmarkMallocgcScanSlice416)
  1599  		b.Run("size=448", benchmarkMallocgcScanSlice448)
  1600  		b.Run("size=480", benchmarkMallocgcScanSlice480)
  1601  		b.Run("size=512", benchmarkMallocgcScanSlice512)
  1602  	})
  1603  }
  1604  

View as plain text