- no need to make copies in cases of aliases
- removed deprecated internal shift functions
- minor unrelated simplifications
This change improves pidigits -s -n10000 by almost 20%:
user 0m6.156s (old)
user 0m4.999s (new)
(pidigits -s -n20000 goes from ~25s to ~19s)
R=rsc
CC=golang-dev
https://golang.org/cl/1149041
Because maps are mostly a hidden type, they must be
implemented using reflection values and will not be as
efficient as arrays and slices.
R=rsc
CC=golang-dev
https://golang.org/cl/1127041
- renamed Len -> BitLen, simplified implementation
- renamed old Div, Mod, DivMod -> Que, Rem, QuoRem
- implemented Div, Mod, DivMod (Euclidian definition, more
useful in a mathematical context)
- fixed a bug in Exp (-0 was possible)
- added extra tests to check normalized results everywhere
- uniformly set Int.neg flag at the end of computations
- minor cosmetic cleanups
- ran all tests
R=rsc
CC=golang-dev
https://golang.org/cl/1091041
Import _mulv from Inferno again, change R9 to R2.
Not sure what the other differences were for, but
they weren't working.
TBR=kaib
CC=golang-dev
https://golang.org/cl/1079041
built. Note that they are only built if a //export comment
appears, so other targets should only use them if there is
such a comment.
Fixes#723.
R=rsc
CC=golang-dev
https://golang.org/cl/1073041
When trying to regenerate src/pkg/runtime/darwin/386/defs.h
on a 64 bit capable Snow Leopard (OS X 10.6.3) system I
needed to add -f -m32 to godefs, as this OS and hardware
combination defaults to 64 bit compilation.
For safety, make the same change to the 32 bit FreeBSD
instructions in .../freebsd/defs.c. (Tested OK and no
problems introduced.)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/1052042
- fixed a couple of bugs in the process
(shift right was incorrect for negative numbers)
- added more tests and made some tests more robust
- changed pidigits back to using shifts to multiply
by 2 instead of add
This improves pidigit -s -n 10000 by approx. 5%:
user 0m6.496s (old)
user 0m6.156s (new)
R=rsc
CC=golang-dev
https://golang.org/cl/963044
This results in an improvement of > 35% for the existing Mul benchmark
using the same karatsuba threshold, and an improvement of > 50% with
a slightly higher threshold (32 instead of 30):
big.BenchmarkMul 500 6731846 ns/op (old alg.)
big.BenchmarkMul 500 4351122 ns/op (new alg.)
big.BenchmarkMul 500 3133782 ns/op (new alg., new theshold)
Also:
- tweaked calibrate.go, use same benchmark as for Mul benchmark
R=rsc
CC=golang-dev
https://golang.org/cl/1037041