5 ms·
For comparison, these are the results I got from benchmarking this implementation with Rust's standard .sin() with a Core i3 M 380 (fast_sine is code from blog,
by Asraelite 9y ago
For comparison, these are the results I got from benchmarking this implementation with Rust's standard .sin() with a Core i3 M 380 (fast_sine is code from blog, normal_sine is .sin())
test fast_sine ... bench: 746,638 ns/iter (+/- 2,489)
test normal_sine ... bench: 1,535,147 ns/iter (+/- 13,731)
- stephencanon 9y agoWhat platform (Rust just uses the host system's libm)?
- GlitchMr 9y agoThese ns/iter values seem crazy (a sin function that takes 1.5ms is just really bad). There is implicit loop when using Rust benchmark features, no need to put your own loops.
- stephencanon 9y agoIndeed; the reciprocal throughput of sin() for small arguments should be a few tens of ns at worst.
- Asraelite 9y agoI didn't realize it loops implicitly, that was my first time using the Rust benchmark tool. Doing only a single sine calculation each iteration yields test fast_sine ... bench: 6 ns/iter (+/- 0) test normal_sine ... bench: 13 ns/iter (+/- 0)