Write up Rust benchmark variants

Vectornaut 2024-08-13 20:30:58 +00:00
parent d06e8551ad
commit 34aa1eb66b

@ -14,6 +14,8 @@ To evaluate the performance cost, Aaron wrote a benchmark program in Rust and Ja
- Find the eigenvalues of $A,\;\ldots\;T^{R-1}A$.
To validate the computation, the benchmark program displays the eigenvalues of $T^r A$, with $r \in \{0, \ldots, R\}$ controlled by a slider. Displaying the eigenvalues isn't part of the benchmark computation, so it isn't timed.
The language comparison benchmark uses 64-bit floating point matrices of size $N = 60$. Other variants of the benchmark, used to compare different design decisions within Rust, are described at the end.
## Running the benchmark
### Rust
- To build and run, call `trunk serve --release` from the `rust-benchmark` folder and go to the URL that Trunk is serving.
@ -48,4 +50,11 @@ The Rust version typically ran 611 times as fast as the Scala version, and it
### Chromium
The Rust version typically ran 57 times as fast as the Scala version, with comparable consistency.
- Rust 8090 ms
- Scala: 520590 ms
- Scala: 520590 ms
## Rust benchmark variants
### Low-precision variant
- For matrices of size $N = 50$, using 32-bit floating point instead of 64-bit made the computation about 15% faster (60 ms instead of 70 ms). However, for $N \ge 54$, the 32-bit floating point variant would hang indefinitely! Maybe the target precision doesn't change to accommodate the lower-precision data type?
### Statically sized variant
- For matrices of size $N = 60$, using statically sized matrices instead of dynamically sized ones made the computation about 10% *slower* (125130 ms instead of 110120 ms).
- For matrices of size $N = 50$, using statically sized matrices made the computation about 15% *slower* (80 ms instead of 70 ms).
- For matrices of size $N = 20$, statically and dynamically sized matrices gave comparable run times (1215 ms).