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 Map.msb.u shifts through Base for a bounded U32 bit-width query #1703
Map.msb.u finds a U32's bit width one shift at a time, bounded by its Nat fuel. It is also the bit-width worker used by Map.diff. The JS host has an exact constant-time clz32 primitive for this.
Nine warmed alternating rounds of 100,000 exported calls over varying U32s/fuel: median 10.386 ms before, 2.859 ms after; checksum 2,064,398 on both. A real consumer call, Map.diff('x', '0'), improved from 14.364 ms to 11.052 ms for 100,000 calls. Linux x64/Bun 1.3.13, baseline #1682 head 0b82c20. No gain is claimed for a long-prefix Map.diff workload, where its separate String walk dominates.
The lowering is min(fuel, 32 - clz32(x)). Independent bit-length checks include zero fuel, zero value, high-bit U32s, truncated fuel and fuel above 2^32. C keeps its existing Base path.
Activity