Hi, I have the following simple benchmark code, 

https://go.dev/play/p/m1ClnbdbdWi

I run this on my laptop since Go playground does not run benchmark code.  
 The strange thing is that Copy of float64 is slower than copy using 
generics.   I can imagine generics may add no overhead, but how can it be 
faster?   

ftian@DESKTOP-16FCU43:~/tmp$ go test -bench=.
goos: linux
goarch: amd64
pkg: a
cpu: 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz
BenchmarkCopy-8          5693944               221.7 ns/op
BenchmarkCopyG-8         8885454               137.1 ns/op
PASS
ok      a       2.838s

-- 
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/c2490a51-f820-4d9c-9959-f54cd6c9b77an%40googlegroups.com.

Reply via email to