1
0
mirror of https://github.com/golang/go synced 2024-10-05 00:11:21 -06:00
go/src/pkg/math
Adam Langley 133cdb6707 math/big: save some copies in binaryGCD.
This patch resulted from a bit of quick optimisation in response to a
golang-nuts post. It looks like one could save a couple other copies in
this function, but this addresses the inner loop and is fairly simple.

benchmark                    old ns/op    new ns/op    delta
BenchmarkGCD10x10                 1964         1711  -12.88%
BenchmarkGCD10x100                2019         1736  -14.02%
BenchmarkGCD10x1000               2471         2171  -12.14%
BenchmarkGCD10x10000              6040         5778   -4.34%
BenchmarkGCD10x100000            43204        43025   -0.41%
BenchmarkGCD100x100              11004         8520  -22.57%
BenchmarkGCD100x1000             11820         9446  -20.08%
BenchmarkGCD100x10000            23846        21382  -10.33%
BenchmarkGCD100x100000          133691       131505   -1.64%
BenchmarkGCD1000x1000           120041        95591  -20.37%
BenchmarkGCD1000x10000          136887       113600  -17.01%
BenchmarkGCD1000x100000         295370       273912   -7.26%
BenchmarkGCD10000x10000        2556126      2205198  -13.73%
BenchmarkGCD10000x100000       3159512      2808038  -11.12%
BenchmarkGCD100000x100000    150543094    139986045   -7.01%

R=gri, remyoudompheng
CC=bradfitz, gobot, golang-dev, gri
https://golang.org/cl/9424043
2013-05-15 10:03:22 -04:00
..
big math/big: save some copies in binaryGCD. 2013-05-15 10:03:22 -04:00
cmplx build: remove Make.pkg, Make.tool 2012-01-30 23:43:46 -05:00
rand math/rand: fix typo and add better crash message 2013-04-27 18:50:38 -07:00
abs_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
abs_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
abs_arm.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
abs.go math: regularize build 2011-12-13 15:20:12 -05:00
acosh.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
all_test.go math: handle exponent separately in Log2 2012-12-20 12:23:27 -05:00
asin_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
asin_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
asin_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
asin.go math: regularize build 2011-12-13 15:20:12 -05:00
asinh.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
atan2_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
atan2_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
atan2_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
atan2.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
atan_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
atan_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
atan_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
atan.go math: improve Atan, Asin and Acos accuracy 2012-06-24 19:39:07 -04:00
atanh.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
bits.go math, runtime: use a NaN that matches gcc's 2012-08-07 09:57:14 +08:00
cbrt.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
const.go math: slightly more readable comments 2012-02-23 10:17:24 -08:00
copysign.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
dim_386.s math: regularize build 2011-12-13 15:20:12 -05:00
dim_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
dim_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
dim.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
erf.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
exp2_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
exp2_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
exp2_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
exp_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
exp_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
exp_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
exp.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
expm1_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
expm1_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
expm1_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
expm1.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
export_test.go math: delete non-Sqrt-based Hypot 2011-12-13 17:08:56 -05:00
floor_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
floor_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
floor_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
floor.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
fltasm_amd64.s
frexp_386.s all: match asm variable names to Go func declarations 2012-09-21 00:35:56 -04:00
frexp_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
frexp_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
frexp.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
gamma.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
hypot_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
hypot_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
hypot_arm.s math: delete non-Sqrt-based Hypot 2011-12-13 17:08:56 -05:00
hypot.go math: make Hypot special cases look like others 2013-03-25 17:01:40 -04:00
j0.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
j1.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
jn.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
ldexp_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
ldexp_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
ldexp_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
ldexp.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
lgamma.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
log1p_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
log1p_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
log1p_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
log1p.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
log10_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
log10_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
log10_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
log10.go math: handle exponent separately in Log2 2012-12-20 12:23:27 -05:00
log_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
log_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
log_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
log.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
logb.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
mod_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
mod_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
mod_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
mod.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
modf_386.s all: match asm variable names to Go func declarations 2012-09-21 00:35:56 -04:00
modf_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
modf_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
modf.go math: regularize build 2011-12-13 15:20:12 -05:00
nextafter.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
pow10.go math: special cases for Pow10; delete BUG 2011-12-08 22:06:33 -05:00
pow.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
remainder_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
remainder_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
remainder_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
remainder.go doc: various "the the" and other typos 2012-07-08 11:57:04 +10:00
signbit.go
sin_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
sin_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
sin_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
sin.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
sincos_386.s all: match asm variable names to Go func declarations 2012-09-21 00:35:56 -04:00
sincos_amd64.s math: update definition of NaN in assembly language files 2012-08-09 09:40:05 +10:00
sincos_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
sincos.go math: make function documentation more regular 2012-04-06 14:01:12 -04:00
sinh.go math: add special-cases comments to Sinh and Tanh. 2011-12-05 14:01:24 -05:00
sqrt_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
sqrt_amd64.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
sqrt_arm.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
sqrt.go math: remove repeated comment. 2013-03-22 14:54:20 +11:00
tan_386.s build: update assembly variable names for vet 2013-03-22 12:57:55 -04:00
tan_amd64.s math: regularize build 2011-12-13 15:20:12 -05:00
tan_arm.s math: regularize build 2011-12-13 15:20:12 -05:00
tan.go pkg/math: undo manual inlining of IsInf and IsNaN 2012-02-01 16:08:31 +01:00
tanh.go math: modify a comment to the convention format. 2013-03-25 08:43:51 -07:00
unsafe.go