1
0
mirror of https://github.com/golang/go synced 2024-10-03 14:11:21 -06:00
go/src/strconv
Martin Möhrmann 06ed8f0df7 strconv: speed up atoi for common cases
Add compile time constants for bases 10 and 16 instead of computing the cutoff
value on every invocation of ParseUint by a division.

Reduce usage of slice operations.

amd64:
benchmark              old ns/op     new ns/op     delta
BenchmarkAtoi          44.6          36.0          -19.28%
BenchmarkAtoiNeg       44.2          38.9          -11.99%
BenchmarkAtoi64        72.5          56.7          -21.79%
BenchmarkAtoi64Neg     66.1          58.6          -11.35%

386:
benchmark              old ns/op     new ns/op     delta
BenchmarkAtoi          86.6          73.0          -15.70%
BenchmarkAtoiNeg       86.6          72.3          -16.51%
BenchmarkAtoi64        126           108           -14.29%
BenchmarkAtoi64Neg     126           108           -14.29%

Change-Id: I0a271132120d776c97bb4ed1099793c73e159893
Reviewed-on: https://go-review.googlesource.com/2460
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-08 20:58:26 +00:00
..
testdata
atob_test.go
atob.go
atof_test.go
atof.go
atoi_test.go strconv: add atoi tests for uncommon bases and syntax errors 2015-01-08 16:51:47 +00:00
atoi.go strconv: speed up atoi for common cases 2015-01-08 20:58:26 +00:00
decimal_test.go
decimal.go
extfloat.go
fp_test.go
ftoa_test.go
ftoa.go
internal_test.go
isprint.go
itoa_test.go strconv/itoa: add test to generate the longest output string possible by formatBits 2014-12-27 22:35:08 +00:00
itoa.go strconv: optimize decimal to string conversion 2014-12-30 23:28:02 +00:00
makeisprint.go
quote_example_test.go
quote_test.go
quote.go
strconv_test.go