You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JS U32.pow does one recursive multiply per exponent step #1687
The C primitive already uses exponentiation by squaring, but JS falls back to the linear Base recursion. Bounded, ordinary powers pay for one call per exponent step. The JS primitive can use the same logarithmic algorithm, with Math.imul for wrapping products and arithmetic halving for the Nat exponent.
I measured actual exported modules on main e5527d5 (2.0.37), Linux x64, Bun 1.3.13. These are medians of seven warmed, interleaved before/after rounds, including normal module conversion.
The local change passed 16,804 actual API checks, including first-class references, numerical U32 ordering, all 1,024 astral scalars whose low unit is DC00, packed non-scalars, and wide Nat exponents against a modular-integer oracle. The focused boundary program also ran on emitted JS and native C. This is a native-representation optimization, not a change to generic fold stack limits, Base reduction, parser, kernel or caps.
Activity