To make it worthwhile, you’d have to calculate all the bounding boxes at once in a loop, as I think there are hidden costs to using/calling wasm code (?).
Also, I’m not sure we currently have a frustum check bottleneck, but that may depend on your scene.
Yes, if calling wasm once for each mesh, the algo improvement might not cover the cost of js-wasm calls, like context switching, and call conversions. But it would worth if doing in batches, like, call per 1k or 2k meshes.
Also, since it only need min/max in world space, instead of all 8 corners, the transformation of bounding boxes can be simplified, like cglm’s impl:
It’s strightforward to convert this impl to simd by replacing all vec3 to vec4 (and align pointers), so transformation and check can all be in simd, this should give more performance boost.
This can at least make thinInstanceRefreshBoundingInfo faster with a lot of thin instances.