georust / geographiclib-rs

A port of geographiclib in Rust.
MIT License
40 stars 9 forks source link

Use faster loop iter (despite clippy's advice) #59

Closed michaelkirk closed 8 months ago

michaelkirk commented 8 months ago

Inspired by a9b8f92.

I confess that I'm surprised to see this much improvement from a small change like this.

$ cargo bench --bench="*" rust --  --baseline=main-2024-01-25
direct (rust impl)/default
                        time:   [27.773 µs 27.806 µs 27.842 µs]
                        change: [-4.9255% -4.6540% -4.3868%] (p = 0.00 < 0.05)
                        Performance has improved.

inverse (rust impl)/default
                        time:   [70.088 µs 70.139 µs 70.194 µs]
                        change: [-9.8981% -9.7426% -9.5881%] (p = 0.00 < 0.05)
                        Performance has improved.