> 4775.994 ± 13310.309 Those are pretty wide error bars though...
On Friday 21 June 2024 at 17:15:05 UTC+1 Robert Engels wrote: > I had the opportunity to revisit my interface dispatch benchmark ( > https://github.com/robaho/go-dispatch-test). > > Previously, the dispatching using pointer receivers was nearly 3x slower > (i.e. 5.5 ns to 12.6 ns): > > goos: darwin > goarch: amd64 > pkg: github.com/robaho/go-dispatch-test > BenchmarkIDispatch-8 300000000 5.56 ns/op > BenchmarkDispatch-8 2000000000 1.57 ns/op > BenchmarkArrayParms-8 200000 9265 ns/op > PASS > > and > > goos: darwin > goarch: amd64 > pkg: github.com/robaho/go-dispatch-test > BenchmarkIDispatch-8 100000000 12.6 ns/op > BenchmarkDispatch-8 2000000000 1.57 ns/op > PASS > > > With the latest Go 1.22.4, the performance difference has reversed ! > (tests have been combined for simplicity). > > goos: darwin > goarch: amd64 > pkg: github.com/robaho/go-dispatch-test > cpu: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz > BenchmarkIDispatch-8 535263746 2.118 ns/op > BenchmarkIDispatchPtr-8 675721244 1.773 ns/op > BenchmarkDispatch-8 1000000000 0.6953 ns/op > BenchmarkArrayParms-8 184212 6440 ns/op > PASS > > Pretty impressive work. The interface based dispatch is almost equal to > the Java version now: > > Benchmark Mode Cnt Score Error Units > TestJavaDispatch.TestArrayDispatch avgt 3 4775.994 ± 13310.309 ns/op > TestJavaDispatch.TestDispatch avgt 3 0.941 ± 0.088 ns/op > TestJavaDispatch.TestIDispatch avgt 3 1.331 ± 0.146 ns/op > -- 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/57b5e091-f309-4d5f-b102-f58c3d344776n%40googlegroups.com.