From: Robert Griesemer Date: Thu, 12 Jul 2012 21:19:09 +0000 (-0700) Subject: mat/big: more optimal Karatsuba threshold X-Git-Tag: go1.1rc2~2813 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6a135a0894fff5bbb1885c27fd9eb41b9a2b4e51;p=gostls13.git mat/big: more optimal Karatsuba threshold benchmark old ns/op new ns/op delta BenchmarkHilbert 6253043 6267289 +0.23% BenchmarkMul 45355940 39490633 -12.93% R=r CC=golang-dev https://golang.org/cl/6355104 --- diff --git a/src/pkg/math/big/nat.go b/src/pkg/math/big/nat.go index 04f5dfd8ba..85b9acc0f5 100644 --- a/src/pkg/math/big/nat.go +++ b/src/pkg/math/big/nat.go @@ -236,7 +236,7 @@ func karatsubaSub(z, x nat, n int) { // Operands that are shorter than karatsubaThreshold are multiplied using // "grade school" multiplication; for longer operands the Karatsuba algorithm // is used. -var karatsubaThreshold int = 32 // computed by calibrate.go +var karatsubaThreshold int = 40 // computed by calibrate.go // karatsuba multiplies x and y and leaves the result in z. // Both x and y must have the same length n and n must be a