Hardcore Chaos Testing for Coni's Native Float32 Arrays
When you’re building high-performance applications in the browser, JavaScript’s generic Number type often isn’t enough. You need raw, contiguous memory arrays. In Coni WASM, we rely heavily on native WebAssembly float32 arrays for our most mathematically intensive applications.
Where is Float32 actually used in Coni?
Native float32 arrays (make-float32-array, f32-set!, f32-get) are the absolute backbone of Coni’s performance layer. You’ll find them powering:
- WebGL Geometry: In our
deep-focus-webglapp, we usefloat32arrays to mathematically sculpt an 80,000-vertex brain matrix (240,000 floats!) natively, before shipping it to the GPU in a single shot viajs/float32-buffer. - Game Engine Particle Systems: For games like
flappy-birdorneon-boids, parallelfloat32arrays keep track of thousands of X/Y coordinates, velocities, and lifetimes without garbage collection pauses. - Raw DSP Audio: Our
sound-nodessynthesizer calculates complex impulse responses and noise waveforms natively usingfloat32arrays before mapping them into WebAudio channels.
The Bug: Type Coercion and f64.reinterpret_i64
Because of how critical these arrays are, any bug in them is catastrophic. Recently, we discovered an issue where passing an exact integer (like 150) into f32-set! would mysteriously yield 0.0.