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

Issue 4253049: code review 4253049: fmt: make recursive scan more efficient. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by rog
Modified:
14 years ago
Reviewers:
CC:
r, golang-dev
Visibility:
Public.

Description

fmt: make recursive scan more efficient. Detect when scan is being called recursively and re-use the same scan state. On my machine, for a recursion-heavy benchmark, this results in 44x speed up. This does impose a 4% penalty on the non-recursive case, which can be removed by heap-allocating the saved state, at 40% performance penalty on the recursive case. Either way is fine with me.

Patch Set 1 #

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

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

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

Total comments: 9

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

Total comments: 1

Patch Set 6 : diff -r 98d584670c65 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -25 lines) Patch
M src/pkg/fmt/scan.go View 1 2 3 4 9 chunks +56 lines, -25 lines 0 comments Download
M src/pkg/fmt/scan_test.go View 1 2 3 4 5 2 chunks +117 lines, -0 lines 0 comments Download

Messages

Total messages: 7
rog
Hello r (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years ago (2011-03-03 11:07:52 UTC) #1
r
nice http://codereview.appspot.com/4253049/diff/8001/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/4253049/diff/8001/src/pkg/fmt/scan.go#newcode321 src/pkg/fmt/scan.go:321: if s != nil { i'd prefer comma, ...
14 years ago (2011-03-03 17:44:43 UTC) #2
rog
PTAL http://codereview.appspot.com/4253049/diff/8001/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/4253049/diff/8001/src/pkg/fmt/scan.go#newcode321 src/pkg/fmt/scan.go:321: if s != nil { On 2011/03/03 17:44:43, ...
14 years ago (2011-03-03 18:00:08 UTC) #3
r
http://codereview.appspot.com/4253049/diff/10002/src/pkg/fmt/scan_test.go File src/pkg/fmt/scan_test.go (right): http://codereview.appspot.com/4253049/diff/10002/src/pkg/fmt/scan_test.go#newcode859 src/pkg/fmt/scan_test.go:859: runtime.GC() i guess what's throwing me off is that ...
14 years ago (2011-03-03 18:14:48 UTC) #4
rog
On 3 March 2011 18:14, <r@golang.org> wrote: > > http://codereview.appspot.com/4253049/diff/10002/src/pkg/fmt/scan_test.go > File src/pkg/fmt/scan_test.go (right): > ...
14 years ago (2011-03-03 18:26:27 UTC) #5
rog
PTAL. hackery removed. On 3 March 2011 18:14, <r@golang.org> wrote: > > http://codereview.appspot.com/4253049/diff/10002/src/pkg/fmt/scan_test.go > File ...
14 years ago (2011-03-03 18:37:02 UTC) #6
r
14 years ago (2011-03-03 18:43:34 UTC) #7
*** Submitted as http://code.google.com/p/go/source/detail?r=d46104f37547 ***

fmt: make recursive scan more efficient.
Detect when scan is being called recursively and
re-use the same scan state.

On my machine, for a recursion-heavy benchmark, this
results in 44x speed up. This does impose a 4% penalty
on the non-recursive case, which can be removed by
heap-allocating the saved state, at 40% performance penalty
on the recursive case. Either way is fine with me.

R=r
CC=golang-dev
http://codereview.appspot.com/4253049

Committer: Rob Pike <r@golang.org>
Sign in to reply to this message.

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