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

Issue 144250043: code review 144250043: fmt: make printing of ints 25-35% faster (Closed)

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

Description

fmt: make printing of ints 25-35% faster Inspired by a remark by Leonard Holz, use constants for division BenchmarkSprintfEmpty 130 132 +1.54% BenchmarkSprintfString 438 437 -0.23% BenchmarkSprintfInt 417 414 -0.72% BenchmarkSprintfIntInt 663 691 +4.22% BenchmarkSprintfPrefixedInt 791 774 -2.15% BenchmarkSprintfFloat 701 686 -2.14% BenchmarkManyArgs 2584 2469 -4.45% BenchmarkFprintInt 488 357 -26.84% BenchmarkFprintIntNoAlloc 402 265 -34.08% BenchmarkScanInts 1244346 1267574 +1.87% BenchmarkScanRecursiveInt 1748741 1724138 -1.41% Update issue 3463

Patch Set 1 #

Total comments: 2

Patch Set 2 : diff -r 67bbd0083f7d8b423dfcac34c990d4dcedcca14f https://code.google.com/p/go/ #

Total comments: 3

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

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

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -4 lines) Patch
M src/fmt/fmt_test.go View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download
M src/fmt/format.go View 1 2 3 4 1 chunk +30 lines, -4 lines 0 comments Download

Messages

Total messages: 11
r
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
9 years, 7 months ago (2014-09-19 21:04:43 UTC) #1
josharian
Should this wait until post-freeze? https://codereview.appspot.com/144250043/diff/1/src/fmt/format.go File src/fmt/format.go (right): https://codereview.appspot.com/144250043/diff/1/src/fmt/format.go#newcode208 src/fmt/format.go:208: buf[i] = digits[ua%10] For ...
9 years, 7 months ago (2014-09-19 23:28:44 UTC) #2
r
Hello golang-codereviews@googlegroups.com, josharian@gmail.com (cc: golang-codereviews@googlegroups.com), Please take another look.
9 years, 7 months ago (2014-09-20 18:47:34 UTC) #3
r
https://codereview.appspot.com/144250043/diff/1/src/fmt/format.go File src/fmt/format.go (right): https://codereview.appspot.com/144250043/diff/1/src/fmt/format.go#newcode208 src/fmt/format.go:208: buf[i] = digits[ua%10] worth another 1.5%.
9 years, 7 months ago (2014-09-20 18:47:52 UTC) #4
josharian
LGTM https://codereview.appspot.com/144250043/diff/20001/src/fmt/format.go File src/fmt/format.go (right): https://codereview.appspot.com/144250043/diff/20001/src/fmt/format.go#newcode202 src/fmt/format.go:202: // use constants for the division and modulo; ...
9 years, 7 months ago (2014-09-22 18:12:21 UTC) #5
rsc
https://codereview.appspot.com/144250043/diff/20001/src/fmt/format.go File src/fmt/format.go (right): https://codereview.appspot.com/144250043/diff/20001/src/fmt/format.go#newcode215 src/fmt/format.go:215: ua >>= 4 this should be the same as ...
9 years, 7 months ago (2014-09-22 18:41:16 UTC) #6
r
Hello golang-codereviews@googlegroups.com, josharian@gmail.com, rsc@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
9 years, 7 months ago (2014-09-22 18:55:04 UTC) #7
r
https://codereview.appspot.com/144250043/diff/20001/src/fmt/format.go File src/fmt/format.go (right): https://codereview.appspot.com/144250043/diff/20001/src/fmt/format.go#newcode215 src/fmt/format.go:215: ua >>= 4 i prefer it as is, nice ...
9 years, 7 months ago (2014-09-22 18:56:50 UTC) #8
rsc
LGTM yes, with the new %-removal the & and >> are better
9 years, 7 months ago (2014-09-22 18:57:22 UTC) #9
r
Let's not wait until post-freeze because the speedup will offset the overhead from allocating ints ...
9 years, 7 months ago (2014-09-22 18:58:09 UTC) #10
r
9 years, 7 months ago (2014-09-22 18:58:20 UTC) #11
*** Submitted as https://code.google.com/p/go/source/detail?r=f0cbfc3381c4 ***

fmt: make printing of ints 25-35% faster
Inspired by a remark by Leonard Holz, use constants for division

BenchmarkSprintfEmpty           130           132           +1.54%
BenchmarkSprintfString          438           437           -0.23%
BenchmarkSprintfInt             417           414           -0.72%
BenchmarkSprintfIntInt          663           691           +4.22%
BenchmarkSprintfPrefixedInt     791           774           -2.15%
BenchmarkSprintfFloat           701           686           -2.14%
BenchmarkManyArgs               2584          2469          -4.45%
BenchmarkFprintInt              488           357           -26.84%
BenchmarkFprintIntNoAlloc       402           265           -34.08%
BenchmarkScanInts               1244346       1267574       +1.87%
BenchmarkScanRecursiveInt       1748741       1724138       -1.41%

Update issue 3463

LGTM=josharian, rsc
R=golang-codereviews, josharian, rsc
CC=golang-codereviews
https://codereview.appspot.com/144250043
Sign in to reply to this message.

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