On Sun, May 30, 2021 at 4:04 AM Jan Mercl <0xj...@gmail.com> wrote: > > Within the benchmark loops of the linked code a sufficiently smart compiler > can optimize the source values away completely and/or collapse all writes to > the destination values to a single write.
For example, here are the results when using gccgo on my laptop (Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz): goos: linux goarch: amd64 cpu: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Benchmark_CopyBool-8 1000000000 0.0000015 ns/op Benchmark_CopyByte-8 1000000000 0.0000002 ns/op Benchmark_CopyInt16-8 1000000000 0.0000002 ns/op Benchmark_CopyInt32-8 1000000000 0.0000003 ns/op Benchmark_CopyInt64-8 1000000000 0.0000007 ns/op Benchmark_CopyPointer-8 1000000000 0.6162 ns/op Benchmark_CopyString-8 1000000000 0.5529 ns/op Benchmark_CopySlice-8 1000000000 0.8605 ns/op Benchmark_CopyArray_2_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_3_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_4_elements-8 1000000000 0.0000003 ns/op Benchmark_CopyArray_5_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_6_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_7_elements-8 1000000000 0.0000003 ns/op Benchmark_CopyArray_8_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_9_elements-8 1000000000 0.0000001 ns/op Benchmark_CopyArray_10_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_11_elements-8 1000000000 0.0000001 ns/op Benchmark_CopyArray_12_elements-8 1000000000 0.0000002 ns/op Benchmark_CopyArray_13_elements-8 1000000000 0.0000003 ns/op Benchmark_CopyStruct_2_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_3_fields-8 1000000000 0.0000003 ns/op Benchmark_CopyStruct_4_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_5_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_6_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_7_fields-8 1000000000 0.0000001 ns/op Benchmark_CopyStruct_8_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_9_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_10_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_11_fields-8 1000000000 0.0000002 ns/op Benchmark_CopyStruct_12_fields-8 1000000000 0.0000001 ns/op Benchmark_CopyStruct_13_fields-8 1000000000 0.0000002 ns/op PASS ok command-line-arguments 2.514s Ian -- 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/CAOyqgcULVNdGSiX8uW1a6zpo3Fwrp_-1h6h%2BGON-ntrZhSdYeQ%40mail.gmail.com.