Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(98)

Issue 165950043: code review 165950043: runtime: allocate a list of small integers that interfa...

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 6 months ago by khr
Modified:
9 years, 4 months ago
Reviewers:
gri, rsc
CC:
gri, r, rsc, khr1, golang-codereviews
Visibility:
Public.

Description

runtime: allocate a list of small integers that interfaces can point to. This change avoids allocations in the case where small integers are stored in an interface. benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 2480757900 2448184501 -1.31% BenchmarkFannkuch11 2404707156 2369879305 -1.45% BenchmarkFmtFprintfEmpty 63.1 62.8 -0.48% BenchmarkFmtFprintfString 173 174 +0.58% BenchmarkFmtFprintfInt 180 156 -13.33% BenchmarkFmtFprintfIntInt 288 255 -11.46% BenchmarkFmtFprintfPrefixedInt 253 233 -7.91% BenchmarkFmtFprintfFloat 350 351 +0.29% BenchmarkFmtManyArgs 1088 985 -9.47% BenchmarkGobDecode 8972467 8907096 -0.73% BenchmarkGobEncode 7710615 7711389 +0.01% BenchmarkGzip 353718004 351409270 -0.65% BenchmarkGunzip 87743203 87268032 -0.54% BenchmarkHTTPClientServer 67024 69889 +4.27% BenchmarkJSONEncode 17207806 17357425 +0.87% BenchmarkJSONDecode 65649590 66194083 +0.83% BenchmarkMandelbrot200 3731891 3734023 +0.06% BenchmarkGoParse 3504030 3508157 +0.12% BenchmarkRegexpMatchEasy0_32 113 115 +1.77% BenchmarkRegexpMatchEasy0_1K 284 296 +4.23% BenchmarkRegexpMatchEasy1_32 99.5 98.3 -1.21% BenchmarkRegexpMatchEasy1_1K 810 818 +0.99% BenchmarkRegexpMatchMedium_32 186 184 -1.08% BenchmarkRegexpMatchMedium_1K 63485 62011 -2.32% BenchmarkRegexpMatchHard_32 3097 3124 +0.87% BenchmarkRegexpMatchHard_1K 100096 101571 +1.47% BenchmarkRevcomp 508628203 515428743 +1.34% BenchmarkTemplate 81041347 81873344 +1.03% BenchmarkTimeParse 383 380 -0.78% BenchmarkTimeFormat 344 351 +2.03%

Patch Set 1 #

Patch Set 2 : diff -r bb82d18ac07a29431c5d504d9ec354fe6346b0a0 https://khr%40golang.org@code.google.com/p/go/ #

Total comments: 2

Patch Set 3 : diff -r bb82d18ac07a29431c5d504d9ec354fe6346b0a0 https://code.google.com/p/go/ #

Patch Set 4 : diff -r bb82d18ac07a29431c5d504d9ec354fe6346b0a0 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 9340f9f6dfc9120543617696123f75a3d49a69dd https://code.google.com/p/go/ #

Patch Set 6 : diff -r 9340f9f6dfc9120543617696123f75a3d49a69dd https://code.google.com/p/go/ #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -2 lines) Patch
M src/runtime/iface.go View 1 2 3 chunks +29 lines, -2 lines 2 comments Download
M src/runtime/proc.c View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime/runtime.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 13
gri
https://codereview.appspot.com/165950043/diff/20001/src/runtime/iface.go File src/runtime/iface.go (right): https://codereview.appspot.com/165950043/diff/20001/src/runtime/iface.go#newcode150 src/runtime/iface.go:150: if *(*uintptr)(elem) < uintptr(len(staticints)) && t.size == ptrSize { ...
9 years, 6 months ago (2014-10-31 00:42:20 UTC) #1
r
please include before and after benchmarking results. use cd test/bench/go1 go test -run XXX -bench ...
9 years, 6 months ago (2014-10-31 01:01:36 UTC) #2
khr
Hello gri@golang.org, r@golang.org, rsc@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
9 years, 6 months ago (2014-10-31 04:20:51 UTC) #3
khr1
On Thu, Oct 30, 2014 at 5:42 PM, <gri@golang.org> wrote: > > https://codereview.appspot.com/165950043/diff/20001/src/runtime/iface.go > File ...
9 years, 6 months ago (2014-10-31 05:03:07 UTC) #4
gri
Good point. It'd be interesting to see if special casing one more case (say 32bit ...
9 years, 6 months ago (2014-10-31 05:10:22 UTC) #5
gri
lgtm https://codereview.appspot.com/165950043/diff/100001/src/runtime/iface.go File src/runtime/iface.go (right): https://codereview.appspot.com/165950043/diff/100001/src/runtime/iface.go#newcode156 src/runtime/iface.go:156: } If we don't have the value in ...
9 years, 6 months ago (2014-10-31 05:15:35 UTC) #6
r
https://codereview.appspot.com/165950043/diff/100001/src/runtime/iface.go File src/runtime/iface.go (right): https://codereview.appspot.com/165950043/diff/100001/src/runtime/iface.go#newcode137 src/runtime/iface.go:137: // NOTE: can't do this as a regular init() ...
9 years, 6 months ago (2014-10-31 05:52:30 UTC) #7
rsc
not lgtm yet Is there a reason to do this right now? It seems a ...
9 years, 6 months ago (2014-10-31 11:11:53 UTC) #8
khr1
On Fri, Oct 31, 2014 at 4:11 AM, Russ Cox <rsc@golang.org> wrote: > not lgtm ...
9 years, 6 months ago (2014-10-31 15:13:07 UTC) #9
rsc
On Fri, Oct 31, 2014 at 11:13 AM, Keith Randall <khr@google.com> wrote: > On Fri, ...
9 years, 6 months ago (2014-10-31 15:50:57 UTC) #10
gri
I suggested this optimization. It's a classical VM trick to ameliorate the cost of allocation/boxing. ...
9 years, 6 months ago (2014-10-31 16:54:48 UTC) #11
rsc
Changes introduce bugs. The best way we know to avoid them this is to stop ...
9 years, 6 months ago (2014-10-31 17:28:30 UTC) #12
gobot
9 years, 4 months ago (2014-12-19 05:15:06 UTC) #13
R=close

To the author of this CL:

The Go project has moved to Gerrit Code Review.

If this CL should be continued, please see the latest version of
https://golang.org/doc/contribute.html for instructions on
how to set up Git and the Go project's Gerrit codereview plugin,
and then create a new change with your current code.

If there has been discussion on this CL, please give a link to it
(golang.org/cl/165950043 is best) in the description in your
new CL.

Thanks very much.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b