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

Issue 4910041: code review 4910041: runtime: speed up cgo calls (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 10 months ago by brainman
Modified:
13 years, 10 months ago
Reviewers:
CC:
dvyukov, rsc, golang-dev
Visibility:
Public.

Description

runtime: speed up cgo calls Allocate Defer on stack during cgo calls, as suggested by dvyukov. Also includes some comment corrections. benchmark old,ns/op new,ns/op BenchmarkCgoCall 669 330 (Intel Xeon CPU 1.80GHz * 4, Linux 386)

Patch Set 1 #

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

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

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

Total comments: 2

Patch Set 5 : diff -r 6e221e8adf96 https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 6 : diff -r 1ce42d48298d https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+52 lines, -35 lines) Patch
M misc/cgo/test/basic.go View 1 2 chunks +12 lines, -0 lines 0 comments Download
M misc/cgo/test/cgo_test.go View 1 1 chunk +2 lines, -0 lines 0 comments Download
M src/pkg/runtime/386/asm.s View 1 1 chunk +4 lines, -4 lines 0 comments Download
M src/pkg/runtime/amd64/asm.s View 1 1 chunk +4 lines, -4 lines 0 comments Download
M src/pkg/runtime/cgocall.c View 1 2 3 4 5 7 chunks +21 lines, -23 lines 0 comments Download
M src/pkg/runtime/proc.c View 1 2 3 5 4 chunks +8 lines, -4 lines 0 comments Download
M src/pkg/runtime/runtime.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 16
brainman
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 10 months ago (2011-08-16 02:49:32 UTC) #1
dvyukov
I am a bit skeptical about making G any bigger. Can't we move sparedefer to ...
13 years, 10 months ago (2011-08-16 10:54:04 UTC) #2
rsc
Dmitriy's suggestion sounds good to me. Can you try adding a flag to struct Defer, ...
13 years, 10 months ago (2011-08-16 18:56:19 UTC) #3
brainman
Hello golang-dev@googlegroups.com, dvyukov@google.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-08-17 02:17:56 UTC) #4
dvyukov
Looks splendid to me http://codereview.appspot.com/4910041/diff/2008/src/pkg/runtime/proc.c File src/pkg/runtime/proc.c (right): http://codereview.appspot.com/4910041/diff/2008/src/pkg/runtime/proc.c#newcode1126 src/pkg/runtime/proc.c:1126: runtime·memmove(d->args, d->argp, d->siz); I think ...
13 years, 10 months ago (2011-08-17 07:32:38 UTC) #5
brainman
Hello golang-dev@googlegroups.com, dvyukov@google.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-08-17 12:45:33 UTC) #6
brainman
Thank you for review. http://codereview.appspot.com/4910041/diff/2008/src/pkg/runtime/proc.c File src/pkg/runtime/proc.c (right): http://codereview.appspot.com/4910041/diff/2008/src/pkg/runtime/proc.c#newcode1126 src/pkg/runtime/proc.c:1126: runtime·memmove(d->args, d->argp, d->siz); On 2011/08/17 ...
13 years, 10 months ago (2011-08-17 12:48:07 UTC) #7
dvyukov
On 2011/08/17 12:48:07, brainman wrote: > Thank you for review. > > http://codereview.appspot.com/4910041/diff/2008/src/pkg/runtime/proc.c > File ...
13 years, 10 months ago (2011-08-17 13:25:44 UTC) #8
dvyukov
I've benchmarked it on Xeon E5620 2.40GHz, and it's 50 vs 140 ns.
13 years, 10 months ago (2011-08-17 13:32:26 UTC) #9
rsc
nice http://codereview.appspot.com/4910041/diff/16001/src/pkg/runtime/cgocall.c File src/pkg/runtime/cgocall.c (right): http://codereview.appspot.com/4910041/diff/16001/src/pkg/runtime/cgocall.c#newcode137 src/pkg/runtime/cgocall.c:137: if(d.nofree) { You are assuming that d is ...
13 years, 10 months ago (2011-08-17 15:22:17 UTC) #10
dvyukov
On Wed, Aug 17, 2011 at 7:22 PM, <rsc@golang.org> wrote: > http://codereview.appspot.com/4910041/diff/16001/src/pkg/runtime/proc.c#newcode1127 > src/pkg/runtime/proc.c:1127: d->nofree ...
13 years, 10 months ago (2011-08-17 15:40:35 UTC) #11
rsc
On Wed, Aug 17, 2011 at 11:40, Dmitry Vyukov <dvyukov@google.com> wrote: > On Wed, Aug ...
13 years, 10 months ago (2011-08-17 15:49:54 UTC) #12
brainman
Hello dvyukov@google.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-08-18 02:39:41 UTC) #13
brainman
http://codereview.appspot.com/4910041/diff/16001/src/pkg/runtime/cgocall.c File src/pkg/runtime/cgocall.c (right): http://codereview.appspot.com/4910041/diff/16001/src/pkg/runtime/cgocall.c#newcode137 src/pkg/runtime/cgocall.c:137: if(d.nofree) { On 2011/08/17 15:22:17, rsc wrote: > You ...
13 years, 10 months ago (2011-08-18 02:40:39 UTC) #14
rsc
LGTM
13 years, 10 months ago (2011-08-18 16:16:52 UTC) #15
rsc
13 years, 10 months ago (2011-08-18 16:17:23 UTC) #16
*** Submitted as http://code.google.com/p/go/source/detail?r=2cdc911fc24c ***

runtime: speed up cgo calls

Allocate Defer on stack during cgo calls, as suggested
by dvyukov. Also includes some comment corrections.

benchmark                   old,ns/op   new,ns/op
BenchmarkCgoCall                  669         330
(Intel Xeon CPU 1.80GHz * 4, Linux 386)

R=dvyukov, rsc
CC=golang-dev
http://codereview.appspot.com/4910041

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

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