]> Cypherpunks repositories - gostls13.git/commit
big: ~8x faster number scanning
authorRobert Griesemer <gri@golang.org>
Wed, 1 Jun 2011 21:17:00 +0000 (14:17 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 1 Jun 2011 21:17:00 +0000 (14:17 -0700)
commitce2701b2b0bafba079445100a7b220404a4211ad
tree0d531ce7605522ff669974a09782b59fab250f1a
parent16dbf2182cf1f091c22df07d215586dd38fdbb64
big: ~8x faster number scanning

- better number scanning algorithm
- fixed a couple of bugs related to base interpretation
- added scan benchmark
- added more test cases and made tests more precise
- introduced Int.scan method matching nat.scan
- refactored Int.Scan; now uses int.scan
- refactored Int.SetString; now uses int.scan

There is more potential, this was a fairly simple change.

gotest -test.bench="ScanPi" before/after (best of 3 runs):
big.BenchmarkScanPi    1000     2024900 ns/op
big.BenchmarkScanPi       10000      257540 ns/op

R=chickencha
CC=golang-dev, rsc
https://golang.org/cl/4527089
src/pkg/big/int.go
src/pkg/big/nat.go
src/pkg/big/nat_test.go