Comment

Comment by creata

I haven't benchmarked, so these opinions might be worthless, but here's how they're laid out internally.

* nalgebra uses fixed-size arrays (so a Vec4 is like [[f32; 4]; 1])

* this library seems to use fields (so a Vec4 is a struct with x,y,z,w fields)

* glam uses SIMD types for some types (so a Vec4 is a __m128)

I think maybe glam might win for some operations, but if you want performance, people usually SIMD in the other direction when possible, like:

    struct Vec4 { x: __m128, y: __m128, z: __m128, w: __m128 }
According to mathbench-rs[0] (which I looked at after typing this comment...) it looks like nalgebra and ultraviolet have such types. The benchmarks have "N/A" for many of the "wide" nalgebra entries though, which might indicate that nalgebra hasn't implemented many of those functions for "wide" types.

[0]: https://github.com/bitshifter/mathbench-rs

parent creata 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton