]> Cypherpunks repositories - gostls13.git/commit
math/big: make division faster
authorRuss Cox <rsc@golang.org>
Fri, 7 Oct 2016 02:42:20 +0000 (22:42 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 10 Oct 2016 18:50:23 +0000 (18:50 +0000)
commit3a9072829e7d315ecda030281b622632c1bbe1b6
treee22a895267181fc3e2bdc170f19129d4d9f19cb3
parent68331750dac5a38c5158f57ab19e3e99d11a59e3
math/big: make division faster

- Add new BenchmarkQuoRem.
- Eliminate allocation in divLarge nat pool
- Unroll mulAddVWW body 4x
- Remove some redundant slice loads in divLarge

name      old time/op  new time/op  delta
QuoRem-8  2.18µs ± 1%  1.93µs ± 1%  -11.38%  (p=0.000 n=19+18)

The starting point in the comparison here is Cherry's
pending CL to turn mulWW and divWW into intrinsics.
The optimizations in divLarge work best because all
the function calls are gone. The effect of this CL is not
as large if you don't assume Cherry's CL.

Change-Id: Ia6138907489c5b9168497912e43705634e163b35
Reviewed-on: https://go-review.googlesource.com/30613
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/math/big/arith_amd64.s
src/math/big/int_test.go
src/math/big/nat.go