Commit 6a135a08 authored by Robert Griesemer's avatar Robert Griesemer

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
parent 98ca6559
...@@ -236,7 +236,7 @@ func karatsubaSub(z, x nat, n int) { ...@@ -236,7 +236,7 @@ func karatsubaSub(z, x nat, n int) {
// Operands that are shorter than karatsubaThreshold are multiplied using // Operands that are shorter than karatsubaThreshold are multiplied using
// "grade school" multiplication; for longer operands the Karatsuba algorithm // "grade school" multiplication; for longer operands the Karatsuba algorithm
// is used. // 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. // 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 // Both x and y must have the same length n and n must be a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment