Code review - Issue 5777048: code review 5777048: runtime: add interface microbenchmarkshttps://codereview.appspot.com/2012-04-11T12:46:03+00:00rietveld
Message from unknown
2012-03-10T09:24:14+00:00dfcurn:md5:c31334484a08a830f25bfccf47fc8848
Message from unknown
2012-03-10T09:24:21+00:00dfcurn:md5:cbc197fc67856515116ea28fa7f2f023
Message from unknown
2012-03-10T09:26:22+00:00dfcurn:md5:d5050bec984d21a87a723d92bf85b876
Message from dave@cheney.net
2012-03-10T09:26:29+00:00dfcurn:md5:a0f599d888b3dedfca1f16cb6409d523
Hello minux.ma@gmail.com (cc: golang-dev@googlegroups.com),
I'd like you to review this change to
https://go.googlecode.com/hg/
Message from unknown
2012-03-10T21:23:02+00:00dfcurn:md5:a875bc80b819969f48b9324b849726e7
Message from unknown
2012-03-10T21:26:19+00:00dfcurn:md5:c37aa35e0421351f08280f7d9a0f364d
Message from dave@cheney.net
2012-03-10T21:26:25+00:00dfcurn:md5:1466bb5d3c9c5c70ee07d0872732ea88
Hello minux.ma@gmail.com (cc: golang-dev@googlegroups.com),
Please take another look.
Message from minux.ma@gmail.com
2012-03-11T10:45:21+00:00minux1urn:md5:3a40b1e7de98b2c5e3b295bcdefa53d0
lack BenchmarkAssertE2E?
http://codereview.appspot.com/5777048/diff/6001/src/pkg/runtime/iface_test.go
File src/pkg/runtime/iface_test.go (right):
http://codereview.appspot.com/5777048/diff/6001/src/pkg/runtime/iface_test.go#newcode70
src/pkg/runtime/iface_test.go:70: func BenchmarkAssertI2E(b *testing.B) {
This function doesn't bench runtime.assertI2E, but runtime.assertE2I.
Message from unknown
2012-03-11T10:55:40+00:00dfcurn:md5:3aa64a4188185b5a047efe667f3da046
Message from dave@cheney.net
2012-03-11T10:55:49+00:00dfcurn:md5:016ebb205626851106f24c9df8846ff1
On 2012/03/11 10:45:21, minux wrote:
> lack BenchmarkAssertE2E?
I couldn't figure out how to trigger it, any suggestions ?
>http://codereview.appspot.com/5777048/diff/6001/src/pkg/runtime/iface_test.go
> File src/pkg/runtime/iface_test.go (right):
>
> http://codereview.appspot.com/5777048/diff/6001/src/pkg/runtime/iface_test.go#newcode70
> src/pkg/runtime/iface_test.go:70: func BenchmarkAssertI2E(b *testing.B) {
> This function doesn't bench runtime.assertI2E, but runtime.assertE2I.
Thanks, that is a duplicate, dropped.
Message from unknown
2012-03-11T10:56:06+00:00dfcurn:md5:656d80499519a8398e76fe3a217a8f10
Message from dave@cheney.net
2012-03-11T10:56:12+00:00dfcurn:md5:fe8ff5cc10b4614d44772b75eb59ddc0
Hello minux.ma@gmail.com (cc: golang-dev@googlegroups.com),
Please take another look.
Message from unknown
2012-03-11T10:56:37+00:00dfcurn:md5:2305d943c6d225b1c0694431c1bcade7
Message from minux.ma@gmail.com
2012-03-11T12:40:13+00:00minux1urn:md5:8b2a648a5288fa9aa591b37f581f75f1
On 2012/03/11 10:55:49, dfc wrote:
> On 2012/03/11 10:45:21, minux wrote:
> > lack BenchmarkAssertE2E?
> I couldn't figure out how to trigger it, any suggestions ?
I = I2.(interface{})
Message from unknown
2012-03-11T21:43:13+00:00dfcurn:md5:f9037d5acf5ded42f8c3a8dbe54f8f32
Message from dave@cheney.net
2012-03-11T21:43:19+00:00dfcurn:md5:4985dfaae70a4fe63295da2731cf591b
Hello minux.ma@gmail.com (cc: golang-dev@googlegroups.com),
Please take another look.
Message from rsc@golang.org
2012-03-12T16:31:14+00:00rscurn:md5:88a17285cc6e76b844435234e1229cb4
This is great, but not now. It's not something that is important for
Go 1, so let's leave it until after Go 1.
Thanks.
Message from dave@cheney.net
2012-03-12T19:43:36+00:00dfcurn:md5:850dadce679d99a771b1629032103a14
Understood.
On 13/03/2012, at 3:31, Russ Cox <rsc@golang.org> wrote:
> This is great, but not now. It's not something that is important for
> Go 1, so let's leave it until after Go 1.
>
> Thanks.
Message from minux.ma@gmail.com
2012-03-12T20:06:37+00:00minux1urn:md5:85a019513d33c3589bb38c2be75e632f
Thus we have some more time to write the remaining BenchmarkAssertI2E? :-)
On Tue, Mar 13, 2012 at 3:44 AM, Dave Cheney <dave@cheney.net> wrote:
> Understood.
>
> On 13/03/2012, at 3:31, Russ Cox <rsc@golang.org> wrote:
>
> > This is great, but not now. It's not something that is important for
> > Go 1, so let's leave it until after Go 1.
> >
> > Thanks.
>
Message from unknown
2012-03-17T09:07:53+00:00dfcurn:md5:a61d72ccd444194093eeed55faee526e
Message from unknown
2012-03-17T09:24:26+00:00dfcurn:md5:554e75f52989cfbbd4a8ecb1a286a6b7
Message from unknown
2012-03-17T09:26:54+00:00dfcurn:md5:5ba6e06bc2ff11d441ab90305bf88c3b
Message from unknown
2012-03-17T09:30:35+00:00dfcurn:md5:4ad5b76715c9ce1dc6dae07fa437ec29
Message from unknown
2012-03-17T09:30:47+00:00dfcurn:md5:e138c4488c2df2a9267fb98692177a75
Message from dave@cheney.net
2012-03-17T09:30:53+00:00dfcurn:md5:0f3bef1e418a8963a28941b1024066a4
Hello minux.ma@gmail.com, rsc@golang.org (cc: golang-dev@googlegroups.com),
Please take another look.
Message from dave@cheney.net
2012-03-17T09:31:14+00:00dfcurn:md5:d5a7fc55dc599b1537234685dc225aaf
Hello, this is the full set now. Leaving til after Go 1.
Message from minux.ma@gmail.com
2012-03-17T09:50:40+00:00minux1urn:md5:045115ecb3a253ab87302817c9d6fb7d
LGTM. Glad you've found the AssertI2E case.
On Sat, Mar 17, 2012 at 5:31 PM, <dave@cheney.net> wrote:
> Hello, this is the full set now. Leaving til after Go 1.
>
> http://codereview.appspot.com/**5777048/<http://codereview.appspot.com/5777048/>
>
Message from fullung@gmail.com
2012-03-17T11:20:00+00:00albert.strasheimurn:md5:ab6fbf9370c9b8b0787848e3b99a45b2
Took these for a spin for fun:
Intel(R) Xeon(R) CPU X5675 @ 3.07GHz
go test -test.bench=.
BenchmarkConvT2E 50000000 36.4 ns/op
BenchmarkConvT2I 100000000 22.1 ns/op
BenchmarkConvI2E 500000000 4.93 ns/op
BenchmarkConvI2I 100000000 13.8 ns/op
BenchmarkAssertE2T 100000000 11.6 ns/op
BenchmarkAssertE2I 100000000 15.7 ns/op
BenchmarkAssertI2T 100000000 11.6 ns/op
BenchmarkAssertI2I 100000000 16.0 ns/op
BenchmarkAssertI2E 500000000 4.64 ns/op
BenchmarkAssertE2E 500000000 4.35 ns/op
go test -compiler=gccgo -gccgoflags='-O2'
BenchmarkConvT2E 50000000 64.7 ns/op
BenchmarkConvT2I 2000000000 0.00 ns/op
BenchmarkConvI2E 2000000000 0.58 ns/op
BenchmarkConvI2I 20000000 90.8 ns/op
BenchmarkAssertE2T 500000000 3.78 ns/op
BenchmarkAssertE2I 20000000 87.8 ns/op
BenchmarkAssertI2T 500000000 4.06 ns/op
BenchmarkAssertI2I 20000000 88.4 ns/op
BenchmarkAssertI2E 500000000 3.48 ns/op
BenchmarkAssertE2E 500000000 3.19 ns/op
Message from bsiegert@gmail.com
2012-03-17T13:18:25+00:00bsiegerturn:md5:263fc99fea6d40dabf98be5a673eb06b
On Sat, Mar 17, 2012 at 12:20, <fullung@gmail.com> wrote:
> BenchmarkConvT2I 2000000000 0.00 ns/op
How is that even possible?
--Benny.
Message from dsymonds@golang.org
2012-03-17T14:03:45+00:00dsymondsurn:md5:ad7b37069a2fcf8c9e9ee408d12d0aad
On Mar 18, 2012 12:18 AM, "Benny Siegert" <bsiegert@gmail.com> wrote:
> On Sat, Mar 17, 2012 at 12:20, <fullung@gmail.com> wrote:
> > BenchmarkConvT2I 2000000000 0.00 ns/op
>
> How is that even possible?
It's as assignment the compiler can statically check, so the runtime code
is just a pointer assignment. I can see that being well under 1ns on a
modern computer; measurement rounding becomes significant down there.
Dave.
Message from rsc@golang.org
2012-03-26T20:00:12+00:00rscurn:md5:80df0261920c78b48d585eefa1ee1a38
On Sat, Mar 17, 2012 at 10:03, David Symonds <dsymonds@golang.org> wrote:
>> On Sat, Mar 17, 2012 at 12:20, <fullung@gmail.com> wrote:
>> > BenchmarkConvT2I 2000000000 0.00 ns/op
>>
>> How is that even possible?
>
> It's as assignment the compiler can statically check, so the runtime code is
> just a pointer assignment. I can see that being well under 1ns on a modern
> computer; measurement rounding becomes significant down there.
No way is it less than 0.005 ns to do each assignment.
gccgo is surely hoisting the assignment out of the loop.
Russ
Message from dave@cheney.net
2012-04-09T00:45:26+00:00dfcurn:md5:d62807ea3da592d26db9c30a8325be29
<ping />
For those interested, I have another CL, http://codereview.appspot.com/5798047/, which manually inlines the call to runtime·rnd which offers considerable performance improvements for the BenchmarkConv* cases.
Message from rsc@golang.org
2012-04-09T19:04:48+00:00rscurn:md5:d2bb6f84129ec446f33b3d0d97033df7
Please add copies of these with suffix 'Big'
that use [2]*int{} as the value. Two pointers
is too big to inline, so the numbers will be
qualitatively different.
Message from dave@cheney.net
2012-04-09T20:59:42+00:00dfcurn:md5:ea54a4dacf7a0949330fd3ba2c743f94
Wilco.
On 10/04/2012, at 5:04, rsc@golang.org wrote:
> Please add copies of these with suffix 'Big'
> that use [2]*int{} as the value. Two pointers
> is too big to inline, so the numbers will be
> qualitatively different.
>
>
>
> http://codereview.appspot.com/5777048/
Message from unknown
2012-04-10T11:40:59+00:00dfcurn:md5:74e89e5ceab28b73444015869ab1b599
Message from dave@cheney.net
2012-04-10T11:43:47+00:00dfcurn:md5:af980db9dcf67dbadce976d64d07a52a
Hi Russ,
PTAL, I have added 2 cases of [2]*int{} where it made sense. Unscientific results are
PASS
BenchmarkConvT2E 20000000 106 ns/op
BenchmarkConvT2EBig 5000000 649 ns/op
BenchmarkConvT2I 10000000 205 ns/op
BenchmarkConvI2E 50000000 30.8 ns/op
BenchmarkConvI2I 20000000 106 ns/op
BenchmarkAssertE2T 50000000 69.5 ns/op
BenchmarkAssertE2TBig 20000000 84.5 ns/op
BenchmarkAssertE2I 20000000 129 ns/op
BenchmarkAssertI2T 20000000 82.6 ns/op
BenchmarkAssertI2I 20000000 129 ns/op
BenchmarkAssertI2E 50000000 29.5 ns/op
BenchmarkAssertE2E 50000000 28.9 ns/op
ok runtime 27.770s
Where pprof says the majority of the time for BenchmarkConvT2EBig is spent in the allocator.
Message from unknown
2012-04-10T11:44:08+00:00dfcurn:md5:c5c5e63c2d08bf3a3b9c510f850759a9
Message from dave@cheney.net
2012-04-10T11:44:15+00:00dfcurn:md5:0951f60322d33b7b7c5ae80ccebf6d7a
Hello minux.ma@gmail.com, rsc@golang.org, fullung@gmail.com, bsiegert@gmail.com, dsymonds@golang.org (cc: golang-dev@googlegroups.com),
Please take another look.
Message from rsc@golang.org
2012-04-10T19:54:52+00:00rscurn:md5:ab00043ecc80fe0d9c4c0a0fc903c217
LGTM
Thank you.
Please put a blank line between the copyright notice and the package statement.
Message from unknown
2012-04-10T20:35:31+00:00dfcurn:md5:83ea9f78ec6ec17f0905fe406bc146cf
Message from dave@cheney.net
2012-04-10T21:11:46+00:00dfcurn:md5:89acaf9bfacfd94c771c6b35f82a990f
Done, and I've also freshened the sample output in the CL description.
Message from unknown
2012-04-11T12:30:48+00:00dfcurn:md5:b200812ecd20c96b5748506e23361fa0
Message from unknown
2012-04-11T12:34:17+00:00dfcurn:md5:b1965143b1ddf8d9603a054de667ce69
Message from unknown
2012-04-11T12:45:36+00:00dfcurn:md5:87f28f12e566776c3d049bc3d8c03a04
Message from dave@cheney.net
2012-04-11T12:46:03+00:00dfcurn:md5:b01f2f544b72e237e2fac6c98a490976
*** Submitted as http://code.google.com/p/go/source/detail?r=a7ca1778740e ***
runtime: add interface microbenchmarks
2011 Mac Mini, Core i5 @ 2.3Ghz
BenchmarkConvT2E 50000000 40.4 ns/op
BenchmarkConvT2EBig 20000000 107 ns/op
BenchmarkConvT2I 100000000 28.9 ns/op
BenchmarkConvI2E 500000000 5.93 ns/op
BenchmarkConvI2I 100000000 19.0 ns/op
BenchmarkAssertE2T 100000000 14.1 ns/op
BenchmarkAssertE2TBig 100000000 17.8 ns/op
BenchmarkAssertE2I 100000000 21.3 ns/op
BenchmarkAssertI2T 100000000 14.3 ns/op
BenchmarkAssertI2I 100000000 20.8 ns/op
BenchmarkAssertI2E 500000000 5.58 ns/op
Pandaboard, 2 x Omap4 @ 1.2Ghz
BenchmarkConvT2E 10000000 215 ns/op
BenchmarkConvT2EBig 1000000 3697 ns/op
BenchmarkConvT2I 5000000 666 ns/op
BenchmarkConvI2E 50000000 42.4 ns/op
BenchmarkConvI2I 5000000 489 ns/op
BenchmarkAssertE2T 20000000 90.0 ns/op
BenchmarkAssertE2TBig 20000000 91.6 ns/op
BenchmarkAssertE2I 5000000 515 ns/op
BenchmarkAssertI2T 20000000 124 ns/op
BenchmarkAssertI2I 5000000 517 ns/op
BenchmarkAssertI2E 50000000 47.2 ns/op
BenchmarkAssertE2E 50000000 42.7 ns/op
R=minux.ma, rsc, fullung, bsiegert, dsymonds
CC=golang-dev
http://codereview.appspot.com/5777048