mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-bigint: raise Toom-3 threshold from 50 to 100 limbs
Benchmarks show the previous threshold of 50 was too low, causing Toom-3's setup overhead to outweigh its asymptotic benefits for medium-sized numbers. Raising to 100 limbs provides: - 2x faster at 300 limbs (192 -> 96 us) - 2.5x faster at 120 limbs (42 -> 17 us) - 2.6x faster at 80 limbs (31 -> 12 us) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -972,7 +972,7 @@ mpz_sqr_basic_limbs(mp_limb *result, const mp_limb *x, size_t n)
|
||||
* - Interpolate to recover result coefficients
|
||||
*/
|
||||
|
||||
#define TOOM3_THRESHOLD 50
|
||||
#define TOOM3_THRESHOLD 100
|
||||
|
||||
static inline mrb_bool
|
||||
should_use_toom3(size_t n)
|
||||
|
||||
Reference in New Issue
Block a user