On Tue, Feb 26, 2013 at 8:47 AM, roger peppe <
rogp...@gmail.com> wrote:
> 20000000 100 ns/op 0 B/op 0 allocs/op
>
> nice to see. inlining the function call
> (
http://play.golang.org/p/wX-shZ9ZGt) gives:
>
> 50000000 46.9 ns/op 0 B/op 0 allocs/op
>
> 2x overhead for creating and using a closure (when the
> closure contains only a few instructions) seems very
> reasonable to me.
Nice to see! ;-)
----
Redoing some of the numbers which worried me a bit (cf. Feb 23th):
(09:20) jnml@fsc-r550:~/tmp$ cat old-ver
go version devel +aee6d7fe395a Sat Jan 26 18:16:43 2013 -0800 linux/amd64
(09:25) jnml@fsc-r550:~/tmp$ go version
go version devel +512627a9cdb8 Mon Feb 25 22:06:58 2013 -0800 linux/amd64
(09:25) jnml@fsc-r550:~/tmp$ benchcmp old.txt new.txt
benchmark old ns/op new ns/op delta
BenchmarkCall2Closure 3 3 -3.19%
BenchmarkCall2Closure1 5 4 -13.92%
BenchmarkCall2Closure2 6 3 -44.35%
BenchmarkCallClosure 2 2 -20.07%
BenchmarkCallClosure1 3 5 +57.10%
BenchmarkCallClosure2 54 60 +11.42%
BenchmarkCallClosure3 55 61 +10.95%
BenchmarkCallClosure4 57 62 +7.83%
benchmark old allocs new allocs delta
BenchmarkCall2Closure 0 0 n/a%
BenchmarkCall2Closure1 0 0 n/a%
BenchmarkCall2Closure2 0 0 n/a%
BenchmarkCallClosure 0 0 n/a%
BenchmarkCallClosure1 0 0 n/a%
BenchmarkCallClosure2 1 1 0.00%
BenchmarkCallClosure3 1 1 0.00%
BenchmarkCallClosure4 1 1 0.00%
benchmark old bytes new bytes delta
BenchmarkCall2Closure 0 0 n/a%
BenchmarkCall2Closure1 0 0 n/a%
BenchmarkCall2Closure2 0 0 n/a%
BenchmarkCallClosure 0 0 n/a%
BenchmarkCallClosure1 0 0 n/a%
BenchmarkCallClosure2 8 8 0.00%
BenchmarkCallClosure3 8 8 0.00%
BenchmarkCallClosure4 8 8 0.00%
(09:25) jnml@fsc-r550:~/tmp$
Has anyone an idea why at this machine (details bellow) the
CallClosure benchmarks give opposite signed deltas (except the first
one) wrt
https://codereview.appspot.com/7397056/ ? I.e. there's a
speed up and here is a slowdown, though I'm comparing different
revisions than the CL, I believe.
(09:25) jnml@fsc-r550:~/tmp$ cat /proc/cpuinfo | head
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
stepping : 10
microcode : 0xa07
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
(09:31) jnml@fsc-r550:~/tmp$
-j