Skip to content
Comparing performance of Rust math libraries for common 3D game and graphics tasks
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
benches Make euler tests use mathbench::random_vec. Jul 15, 2019
scripts Adjusted number formatting Jun 27, 2019
src Added glam_mat4_mul_vec4 to mathbench lib. Jun 28, 2019
tests Add Vec4 dot and normalize tests. Jul 8, 2019
.gitignore Use macro for euler bench, add 2d version. May 12, 2019
.travis.yml Attempt to run benches on travis May 10, 2019
Cargo.toml cargo update for glam 0.7.1 Jul 8, 2019
LICENSE-APACHE Added license. Mar 3, 2019
LICENSE-MIT Added license. Mar 3, 2019 Bumped version, updated README. Jun 13, 2019 Attempt to run benches on travis May 10, 2019


Build Status

A number of benchmarks that compare the performance of different Rust math libraries for common game development and graphics tasks.

mathbench is written by the author of glam and has been used to compare the performance of glam with other similar 3D math libraries targeting games and graphics development, including:

The benchmarks

All benchmarks are performed using

  • euler bench - performs an Euler integration on arrays of 2D and 3D vectors
  • mat benches - performs common matrix operations such as transpose, inverse, determinant and multiply
  • quat benches - peform common quaternion operations
  • transform bench - performs transformations on vectors

Note that cgmath and nalgebra matrix inverse methods return an Option whereas glam does not, giving glam a performance advantage. If a non-invertible matrix is inverted by glam the result will be invalid (it will contain NaNs).

Future work

  • Validate the correctness of each benchmark
  • Add more benchmarks
  • Add packed_simd to benchmarks
  • Add ISPC to benchmarks


Licensed under either of

at your option.


Contributions in any form (issues, pull requests, etc.) to this project must adhere to Rust's Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


If you are interested in contributing or have a request or suggestion create an issue on github.

You can’t perform that action at this time.