bigint/bigint_nonjs.mbt:1101-1133: radix 10 and power-of-two radixes have optimized paths, but other radixes (3, 5, 6, 7, ...) extract digits by repeatedly calling grade_school_div(v, base) — each O(n) — once per output digit (~O(n) digits), i.e. O(n²) overall.
Standard fix: divide by base^k per step, where base^k is the largest power fitting in a limb, extracting k digits per full-bigint division — cutting the number of O(n) divisions by a factor of ~k (e.g. k=20 for radix 3 with 32-bit limbs, k=12 for radix 6).
Low urgency (odd radixes are rare) but the fix is mechanical and the surrounding radix-10 code (decimal_mask batching at line ~1019) already demonstrates the pattern.
bigint/bigint_nonjs.mbt:1101-1133: radix 10 and power-of-two radixes have optimized paths, but other radixes (3, 5, 6, 7, ...) extract digits by repeatedly callinggrade_school_div(v, base)— each O(n) — once per output digit (~O(n) digits), i.e. O(n²) overall.Standard fix: divide by
base^kper step, wherebase^kis the largest power fitting in a limb, extractingkdigits per full-bigint division — cutting the number of O(n) divisions by a factor of ~k (e.g. k=20 for radix 3 with 32-bit limbs, k=12 for radix 6).Low urgency (odd radixes are rare) but the fix is mechanical and the surrounding radix-10 code (
decimal_maskbatching at line ~1019) already demonstrates the pattern.