Skip to content

JS F32 bit casts allocate a fresh buffer and typed views on every call #1638

Closed as not planned

Description

@oxura

On main e5527d5, f32_bits and f32_from_bits each create a backing buffer and two typed-array views per call. A real exported Bend function bits(x: F32) -> U32 takes about 294-308 ms for one million warmed calls on Bun 1.3.13/Linux x86-64. This is unnecessary allocation on numeric code paths: the cast is synchronous and its backing storage never escapes. I am testing one private four-byte DataView reused by both helpers, with actual exported-module calls covering signed zero, subnormal values, and the largest finite F32. No representation change or NaN-payload guarantee is intended.

Activity

  1. Lorenzobattistela commented on Oct 20, 2026

    @Lorenzobattistela
    Collaborator

    Closing per #1644: JS is the reference runtime, so we don't take JS-only performance changes (see #1643).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions