mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
ece641c56f
use the mathematical identity 10^k = 2^k * 5^k to speed up the divide-and-conquer decimal string conversion. dividing by 5^k is faster than dividing by 10^k because 5^k has ~30% fewer bits (log2(5) ≈ 2.32 vs log2(10) ≈ 3.32). the 2^k component is handled with fast bit shifts. benchmarks show 3-8% improvement for large numbers: - 800K bits: 1.00s -> 0.97s - 1.6M bits: 3.95s -> 3.84s - 2.4M bits: 8.79s -> 8.46s Co-authored-by: Claude <noreply@anthropic.com>