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

Issue 9101048: code review 9101048: cmd/gc: inline copy in frontend to call memmove directly. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 11 months ago by remyoudompheng
Modified:
10 years, 7 months ago
Reviewers:
rsc
CC:
golang-dev, bradfitz, cshapiro1, dave_cheney.net, DMorsing, rsc, khr, khr1
Visibility:
Public.

Description

cmd/gc: inline copy in frontend to call memmove directly. A new node type OSPTR is added to refer to the data pointer of strings and slices in a simple way during walk(). It will be useful for future work on simplification of slice arithmetic. benchmark old ns/op new ns/op delta BenchmarkCopy1Byte 9 8 -13.98% BenchmarkCopy2Byte 14 8 -40.49% BenchmarkCopy4Byte 13 8 -35.04% BenchmarkCopy8Byte 13 8 -37.10% BenchmarkCopy12Byte 14 12 -15.38% BenchmarkCopy16Byte 14 12 -17.24% BenchmarkCopy32Byte 19 14 -27.32% BenchmarkCopy128Byte 31 26 -15.29% BenchmarkCopy1024Byte 100 92 -7.50% BenchmarkCopy1String 10 7 -28.99% BenchmarkCopy2String 10 7 -28.06% BenchmarkCopy4String 10 8 -22.69% BenchmarkCopy8String 10 8 -23.30% BenchmarkCopy12String 11 11 -5.88% BenchmarkCopy16String 11 11 -5.08% BenchmarkCopy32String 15 14 -6.58% BenchmarkCopy128String 28 25 -10.60% BenchmarkCopy1024String 95 95 +0.53%

Patch Set 1 #

Patch Set 2 : diff -r 8223559e536b https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 8223559e536b https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 0d28fd55e721 https://go.googlecode.com/hg/ #

Total comments: 5

Patch Set 5 : diff -r 9b8afda16f02 https://go.googlecode.com/hg/ #

Total comments: 15

Patch Set 6 : diff -r 3338bbc9c09b https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r c47375e68297 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+210 lines, -10 lines) Patch
M src/cmd/5g/cgen.c View 1 2 3 4 2 chunks +17 lines, -0 lines 0 comments Download
M src/cmd/5g/gsubr.c View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download
M src/cmd/6g/cgen.c View 1 2 3 4 2 chunks +17 lines, -0 lines 0 comments Download
M src/cmd/6g/gsubr.c View 1 2 3 4 5 6 2 chunks +11 lines, -0 lines 0 comments Download
M src/cmd/8g/cgen.c View 1 2 3 4 2 chunks +17 lines, -0 lines 0 comments Download
M src/cmd/8g/gsubr.c View 1 2 3 4 2 chunks +11 lines, -0 lines 0 comments Download
M src/cmd/gc/builtin.c View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/gc/go.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/gc/racewalk.c View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/gc/runtime.go View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/gc/typecheck.c View 1 2 3 4 5 1 chunk +14 lines, -1 line 0 comments Download
M src/cmd/gc/walk.c View 1 2 3 4 5 6 5 chunks +69 lines, -9 lines 0 comments Download
M src/pkg/runtime/append_test.go View 1 2 3 4 1 chunk +40 lines, -0 lines 0 comments Download

Messages

Total messages: 36
remyoudompheng
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
10 years, 11 months ago (2013-05-14 23:30:53 UTC) #1
bradfitz
Why does the memmove take uintptr instead of, say, *byte? On Tue, May 14, 2013 ...
10 years, 11 months ago (2013-05-14 23:41:55 UTC) #2
cshapiro1
On 2013/05/14 23:41:55, bradfitz wrote: > Why does the memmove take uintptr instead of, say, ...
10 years, 11 months ago (2013-05-14 23:47:49 UTC) #3
remyoudompheng
2013/5/15 Brad Fitzpatrick <bradfitz@golang.org>: > Why does the memmove take uintptr instead of, say, *byte? ...
10 years, 11 months ago (2013-05-14 23:47:53 UTC) #4
bradfitz
Yes. Everybody needs to get into the habit now of never using uintptr for a ...
10 years, 11 months ago (2013-05-14 23:49:57 UTC) #5
cshapiro1
On 2013/05/14 23:47:53, remyoudompheng wrote: > There's no particular reason (it's just less verbose for ...
10 years, 11 months ago (2013-05-14 23:50:05 UTC) #6
remyoudompheng
Hello golang-dev@googlegroups.com, bradfitz@golang.org, cshapiro@google.com (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 11 months ago (2013-05-16 06:39:37 UTC) #7
dave_cheney.net
Nice improvement on linux/arm (from pandaboard) alarm(~/go/src/pkg/runtime) % ~/go/misc/benchcmp {old,new}.txt benchmark old ns/op new ns/op ...
10 years, 11 months ago (2013-05-18 01:14:40 UTC) #8
remyoudompheng
On 2013/05/18 01:14:40, dfc wrote: > Nice improvement on linux/arm (from pandaboard) > > alarm(~/go/src/pkg/runtime) ...
10 years, 11 months ago (2013-05-18 08:15:51 UTC) #9
dave_cheney.net
I'll try the same benchmark on my A15 chromebook later. Faster processor and memory, but ...
10 years, 11 months ago (2013-05-18 08:20:17 UTC) #10
dave_cheney.net
Here are results from linux/arm on a chromebook localhost(~/go/src/pkg/runtime) % ~/go/misc/benchcmp {old,new}.txt benchmark old ns/op ...
10 years, 11 months ago (2013-05-18 23:58:34 UTC) #11
dave_cheney.net
ping
10 years, 11 months ago (2013-05-24 08:11:42 UTC) #12
dave_cheney.net
On 2013/05/24 08:11:42, dfc wrote: > ping ping
10 years, 11 months ago (2013-05-27 22:06:09 UTC) #13
DMorsing
https://codereview.appspot.com/9101048/diff/13001/src/cmd/gc/typecheck.c File src/cmd/gc/typecheck.c (right): https://codereview.appspot.com/9101048/diff/13001/src/cmd/gc/typecheck.c#newcode1576 src/cmd/gc/typecheck.c:1576: n->type = types[TUNSAFEPTR]; Use TUINTPTR here. Using unsafe means ...
10 years, 11 months ago (2013-05-28 15:37:20 UTC) #14
rsc
Please use unsafe.Pointer. That's what it's for. If we need to add some more selective ...
10 years, 10 months ago (2013-06-03 19:56:30 UTC) #15
DMorsing
On 2013/06/03 19:56:30, rsc wrote: > Please use unsafe.Pointer. That's what it's for. If we ...
10 years, 10 months ago (2013-06-03 20:01:40 UTC) #16
remyoudompheng
So it's already unsafe.Pointer. Is it okay that memmove uses *byte? Also, the node "OSPTR" ...
10 years, 10 months ago (2013-06-04 07:03:39 UTC) #17
rsc
Looks good mostly. Using *byte is fine for now. In general the compiler will need ...
10 years, 10 months ago (2013-06-10 20:31:56 UTC) #18
DMorsing
ping?
10 years, 10 months ago (2013-06-21 18:06:01 UTC) #19
rsc
sorry, just overwhelmed by all the runtime stuff. will review tomorrow.
10 years, 10 months ago (2013-06-27 03:17:54 UTC) #20
rsc
ha, this ping was for remy not for me. :-)
10 years, 10 months ago (2013-06-27 15:41:36 UTC) #21
bradfitz
Remy, ping. Do you plan to finish/submit this, or is it superseded by other CLs ...
10 years, 9 months ago (2013-07-23 16:37:37 UTC) #22
remyoudompheng
On 2013/07/23 16:37:37, bradfitz wrote: > Remy, ping. > > Do you plan to finish/submit ...
10 years, 9 months ago (2013-07-28 16:32:35 UTC) #23
remyoudompheng
Hello golang-dev@googlegroups.com, bradfitz@golang.org, cshapiro@google.com, dave@cheney.net, daniel.morsing@gmail.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 8 months ago (2013-08-18 14:41:19 UTC) #24
remyoudompheng
On 2013/07/28 16:32:35, remyoudompheng wrote: > On 2013/07/23 16:37:37, bradfitz wrote: > > Remy, ping. ...
10 years, 8 months ago (2013-08-18 14:42:50 UTC) #25
remyoudompheng
https://codereview.appspot.com/9101048/diff/13001/src/cmd/gc/gen.c File src/cmd/gc/gen.c (right): https://codereview.appspot.com/9101048/diff/13001/src/cmd/gc/gen.c#newcode299 src/cmd/gc/gen.c:299: case OCONVNOP: // FIXME. On 2013/06/10 20:31:57, rsc wrote: ...
10 years, 8 months ago (2013-08-18 14:45:06 UTC) #26
khr
https://codereview.appspot.com/9101048/diff/43001/src/cmd/5g/gsubr.c File src/cmd/5g/gsubr.c (right): https://codereview.appspot.com/9101048/diff/43001/src/cmd/5g/gsubr.c#newcode1369 src/cmd/5g/gsubr.c:1369: a->etype = simtype[TUINTPTR]; Don't we also need the correct ...
10 years, 8 months ago (2013-08-27 20:08:48 UTC) #27
khr1
By the way, do we really need OSPTR, or can we do the same with ...
10 years, 8 months ago (2013-08-27 20:29:44 UTC) #28
rsc
https://codereview.appspot.com/9101048/diff/43001/src/cmd/5g/gsubr.c File src/cmd/5g/gsubr.c (right): https://codereview.appspot.com/9101048/diff/43001/src/cmd/5g/gsubr.c#newcode1369 src/cmd/5g/gsubr.c:1369: a->etype = simtype[TUINTPTR]; On 2013/08/27 20:08:50, khr wrote: > ...
10 years, 7 months ago (2013-09-06 19:37:24 UTC) #29
rsc
On Tue, Aug 27, 2013 at 4:29 PM, Keith Randall <khr@google.com> wrote: > By the ...
10 years, 7 months ago (2013-09-06 20:11:06 UTC) #30
remyoudompheng
https://codereview.appspot.com/9101048/diff/43001/src/cmd/gc/go.h File src/cmd/gc/go.h (right): https://codereview.appspot.com/9101048/diff/43001/src/cmd/gc/go.h#newcode575 src/cmd/gc/go.h:575: OSPTR, // data word of a slice or string ...
10 years, 7 months ago (2013-09-07 13:07:21 UTC) #31
remyoudompheng
Hello golang-dev@googlegroups.com, bradfitz@golang.org, cshapiro@google.com, dave@cheney.net, daniel.morsing@gmail.com, rsc@golang.org, khr@golang.org, khr@google.com (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 7 months ago (2013-09-07 13:07:41 UTC) #32
remyoudompheng
On 2013/09/07 13:07:41, remyoudompheng wrote: > Hello mailto:golang-dev@googlegroups.com, mailto:bradfitz@golang.org, mailto:cshapiro@google.com, > mailto:dave@cheney.net, mailto:daniel.morsing@gmail.com, mailto:rsc@golang.org, mailto:khr@golang.org, ...
10 years, 7 months ago (2013-09-10 19:19:37 UTC) #33
remyoudompheng
Do we want this in Go 1.2? The CL was created the day after Go ...
10 years, 7 months ago (2013-09-11 19:45:23 UTC) #34
rsc
LGTM Yes, sorry. Just a bit behind.
10 years, 7 months ago (2013-09-11 20:51:28 UTC) #35
remyoudompheng
10 years, 7 months ago (2013-09-11 22:37:33 UTC) #36
*** Submitted as https://code.google.com/p/go/source/detail?r=75118231847b ***

cmd/gc: inline copy in frontend to call memmove directly.

A new node type OSPTR is added to refer to the data pointer of
strings and slices in a simple way during walk(). It will be
useful for future work on simplification of slice arithmetic.

benchmark                  old ns/op    new ns/op    delta
BenchmarkCopy1Byte                 9            8  -13.98%
BenchmarkCopy2Byte                14            8  -40.49%
BenchmarkCopy4Byte                13            8  -35.04%
BenchmarkCopy8Byte                13            8  -37.10%
BenchmarkCopy12Byte               14           12  -15.38%
BenchmarkCopy16Byte               14           12  -17.24%
BenchmarkCopy32Byte               19           14  -27.32%
BenchmarkCopy128Byte              31           26  -15.29%
BenchmarkCopy1024Byte            100           92   -7.50%
BenchmarkCopy1String              10            7  -28.99%
BenchmarkCopy2String              10            7  -28.06%
BenchmarkCopy4String              10            8  -22.69%
BenchmarkCopy8String              10            8  -23.30%
BenchmarkCopy12String             11           11   -5.88%
BenchmarkCopy16String             11           11   -5.08%
BenchmarkCopy32String             15           14   -6.58%
BenchmarkCopy128String            28           25  -10.60%
BenchmarkCopy1024String           95           95   +0.53%

R=golang-dev, bradfitz, cshapiro, dave, daniel.morsing, rsc, khr, khr
CC=golang-dev
https://codereview.appspot.com/9101048
Sign in to reply to this message.

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