Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Lorenzobattistela
left a comment
There was a problem hiding this comment.
Thanks! The speedup is real and all gates are green. I pushed a commit that drops the GUIDE edit; we don't want that change in the guide. Three small things before we merge:
- Don't duplicate the bend.ts helpers.
bend.tsalready has these exact casts:F32_VIEW,f32_to_bitsandf32_from_bits. comp.ts already splices${Bend.f32_round}into the JS runtime, so reuse the bend.ts versions the same way instead of keeping a second copy in comp.ts. - Drop the
, truearguments. Each cast writes and reads with the same byte order, so the little-endian flag changes nothing. Big-endian, the default that bend.ts uses, gives the same bits. The four arguments just cost ttok in comp.ts. - Remove
lib.bits(0.75)from the test loop. It can't catch a scratch-reuse bug:valueis already a JS number before that call, andlib.bits(value)rewrites the buffer before reading it. The round-trip table on its own is the useful part.
|
This is JS-only performance work, so I’m withdrawing it following the reference-runtime policy in #1644. |
|
I closed this too quickly after reading #1644 — sorry. Reopening it and taking care of these three points. |
|
Done — comp.ts now splices in the two bend.ts helpers and uses their default byte order. Dropped the extra test call. The exported-module smoke passes (0 / 16777216), and the repo gate is 54/54. |
|
Thanks for addressing the review so quickly, and sorry about the back and forth. After looking at it again, we're closing this one under the #1644 policy: JS is the reference runtime, so we don't take JS-only performance changes, and perf work goes to the C side. comp.ts is also close to its token cap, so we're keeping changes there to the ones that are needed. |
|
Understood, thanks for taking another look. I'll keep perf work on the C side. |
Fixes #1638.
The JS bit casts share a four-byte buffer instead of allocating one for every call. They reuse the cast functions from bend.ts, with no second implementation or endian flags.
Kept the round-trip table for signed zero, subnormals, finite bounds and infinities; removed the unrelated
lib.bits(0.75)call. No new NaN-payload guarantee.Local generated-module smoke:
0/16777216. Repo gate: 54/54. The maintainer ran the full gates on the previous head; I haven’t rerun the private gates locally.