Luxuride
Edit Post
Raw post Delete Post

My Rust matrix multiplication + benchmarks

Author:
Luxuride

Context

This blog post is based on my repository.

To add some context, I tried to implement matrix multiplication in rust for the sake of it, and ended up making pretty robust structure with traits. Thanks to the use of generics I even managed for the matrix to be element of matrix.

So now to the data. The data is split into 2 solutions. 1 using transposition, the other one not.

Data

Following data is verifiable data on gitlab pipeline.

Benchmark Transposition No Transposition
f64 100x50 309,521 ns/iter (+/- 14,516) 875,071 ns/iter (+/- 12,769)
f64 5x5 1,648 ns/iter (+/- 32) 1,392 ns/iter (+/- 41)

Just from those 2 benchmarks it is visible that transposition helps more and more on bigger matrices.

On the following line there will be more robust data taken on my laptop

Benchmark Transposition No Transposition
f64 100x50 390,190 ns/iter (+/- 19,576) 680,935 ns/iter (+/- 26,011)
f64 500x500 136,923,363 ns/iter (+/- 9,027,149) 553,209,462 ns/iter (+/- 274,868,365)
f64 5x5 3,466 ns/iter (+/- 744) 2,805 ns/iter (+/- 1,598)

On the 500x500 example it is clearly visible how much the transposition helps in the calculation.