On Sat, May 29, 2021 at 8:50 PM tapi...@gmail.com <tapir....@gmail.com> wrote:
> The benchmark code: https://play.golang.org/p/bC1zO14eNeh > ... > From the benchmark result, it looks > * the cost of copying a [13]int value is much larger than copying a > [12]int value. > * the cost of copying a struct{a, b, c int} value is about double of > copying a struct{a, b, c, d int} value. > The size, and internal layout, of structs has a huge effect on these types of benchmarks due to the interaction with the L1 and L2 caches and the CPU architecture policies for the management of those caches. Thus this type of benchmark needs to document the CPU architecture being used and also the results on other architectures. It would not be at all surprising if changing the implementation to improve the results on your system resulted in slower behavior on other systems. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD9ELLH3yhM4cN7zXui27Dd0T%2BYUN-coeuLiyDS1LPSLeg%40mail.gmail.com.