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

Issue 6497073: code review 6497073: cmd/6g: avoid taking the address of slices unnecessarily. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by remyoudompheng
Modified:
11 years, 6 months ago
Reviewers:
CC:
golang-dev, rsc, dfc, remy_archlinux.org
Visibility:
Public.

Description

cmd/6g: avoid taking the address of slices unnecessarily. The main case where it happens is when evaluating &s[i] without bounds checking, which usually happens during range loops (i=0). This allows registerization of the corresponding variables, saving 16 bytes of stack frame for each such range loop and a LEAQ instruction.

Patch Set 1 #

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

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

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -34 lines) Patch
M src/cmd/6g/cgen.c View 1 2 3 8 chunks +39 lines, -34 lines 0 comments Download

Messages

Total messages: 9
remyoudompheng
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com, remy@archlinux.org), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 7 months ago (2012-09-01 18:48:42 UTC) #1
remyoudompheng
This is mainly a little experiment. I could not find any measurable performance improvement, but ...
11 years, 7 months ago (2012-09-01 18:51:05 UTC) #2
rsc
Removing LEAQ instructions is justification enough: you don't need a measurement to back it up. ...
11 years, 7 months ago (2012-09-01 19:55:10 UTC) #3
remyoudompheng
I will try that. In my previous comment I say the patch is experimental because ...
11 years, 7 months ago (2012-09-01 20:09:24 UTC) #4
rsc
On Sat, Sep 1, 2012 at 4:09 PM, <remyoudompheng@gmail.com> wrote: > I will try that. ...
11 years, 7 months ago (2012-09-01 23:06:34 UTC) #5
remyoudompheng
Hello golang-dev@googlegroups.com, rsc@golang.org (cc: golang-dev@googlegroups.com, remy@archlinux.org), Please take another look.
11 years, 7 months ago (2012-09-01 23:53:37 UTC) #6
dfc
ping ?
11 years, 6 months ago (2012-09-07 01:58:35 UTC) #7
rsc
LGTM
11 years, 6 months ago (2012-09-07 02:05:19 UTC) #8
remyoudompheng
11 years, 6 months ago (2012-09-07 04:54:47 UTC) #9
*** Submitted as http://code.google.com/p/go/source/detail?r=a76067712fe9 ***

cmd/6g: avoid taking the address of slices unnecessarily.

The main case where it happens is when evaluating &s[i] without
bounds checking, which usually happens during range loops (i=0).

This allows registerization of the corresponding variables,
saving 16 bytes of stack frame for each such range loop and a
LEAQ instruction.

R=golang-dev, rsc, dave
CC=golang-dev, remy
http://codereview.appspot.com/6497073
Sign in to reply to this message.

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