From 32aed6ad8cb9aa32bf8df2766bbfb7ac83a6ecf2 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 3 Oct 2024 18:13:43 +0900 Subject: [PATCH] mruby-bigint: increase KARATSUBA_THREASHOLD to 512 Since Karatsuba algorithm is far heavier than the basic multiplication, we have increased KARATSUBA_THREASHOLD and decreased MAX_RECURSION_DEPTH. --- mrbgems/mruby-bigint/core/bigint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mrbgems/mruby-bigint/core/bigint.c b/mrbgems/mruby-bigint/core/bigint.c index 330d65eed..8a9a17862 100644 --- a/mrbgems/mruby-bigint/core/bigint.c +++ b/mrbgems/mruby-bigint/core/bigint.c @@ -385,8 +385,8 @@ mul_base(mrb_state *mrb, mpz_t *ww, mpz_t *u, mpz_t *v) static void mpz_mul_2exp(mrb_state *mrb, mpz_t *z, mpz_t *x, mrb_int e); /* Thresholds */ -#define KARATSUBA_THRESHOLD 32 -#define MAX_RECURSION_DEPTH 16 +#define KARATSUBA_THRESHOLD 512 +#define MAX_RECURSION_DEPTH 10 /* Karatsuba Multiply */ static void