• Rob Pike's avatar
    fmt: speed up 10-20% · 53bc1944
    Rob Pike authored
    The check for Stringer etc. can only fire if the test is not a builtin, so avoid
    the expensive check if we know there's no chance.
    Also put in a fast path for pad, which saves a more modest amount.
    
    benchmark                      old ns/op    new ns/op    delta
    BenchmarkSprintfEmpty                148          152   +2.70%
    BenchmarkSprintfString               585          497  -15.04%
    BenchmarkSprintfInt                  441          396  -10.20%
    BenchmarkSprintfIntInt               718          603  -16.02%
    BenchmarkSprintfPrefixedInt          676          621   -8.14%
    BenchmarkSprintfFloat               1003          953   -4.99%
    BenchmarkManyArgs                   2945         2312  -21.49%
    BenchmarkScanInts                1704152      1734441   +1.78%
    BenchmarkScanRecursiveInt        1837397      1828920   -0.46%
    
    R=golang-dev, bradfitz
    CC=golang-dev
    https://golang.org/cl/6245068
    53bc1944
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
exp Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
old/netchan Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...