1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

mpint tuning: lower KARATSUBA_THRESHOLD to 24.

The new testcrypt system made it easy to write a tiny Python program
that does a lot of multiplications of various large sizes, run it
against versions of the testcrypt binary built with lots of different
threshold settings, and time the output by running the Python program
with PUTTY_TESTCRYPT="command time -f %U ./testcrypt".

When I tried that I found that lots of values in the 20-30 range
looked about as good as each other. 24 was an unusually low dip which
could well have just been a random outlier, but it's a nice round
number so I picked it anyway.
This commit is contained in:
Simon Tatham 2019-01-03 11:39:14 +00:00
parent 5b14abc30e
commit 22a79fe733

View File

@ -871,7 +871,7 @@ static void mp_mul_add_simple(mp_int *r, mp_int *a, mp_int *b)
}
#ifndef KARATSUBA_THRESHOLD /* allow redefinition via -D for testing */
#define KARATSUBA_THRESHOLD 50
#define KARATSUBA_THRESHOLD 24
#endif
static inline size_t mp_mul_scratchspace_unary(size_t n)