georust / geographiclib-rs

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

use libm remquo and copysign for a little speedup #61

Closed michaelkirk closed 9 months ago

michaelkirk commented 9 months ago

This makes our implement of sincosd look more like the cpp version, and still passes all the same tests.

$ cargo bench --bench="*" -- --baseline=4891fc4
    Finished bench [optimized] target(s) in 0.02s
     Running benches/geodesic_benchmark.rs (target/release/deps/geodesic_benchmark-cda172d0984b8505)
direct (c wrapper)/default
                        time:   [24.046 µs 24.071 µs 24.099 µs]
                        change: [-0.2131% +0.0210% +0.2593%] (p = 0.86 > 0.05)
                        No change in performance detected.
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) low severe
  2 (2.00%) low mild
  1 (1.00%) high mild
  3 (3.00%) high severe

direct (rust impl)/default
                        time:   [26.129 µs 26.168 µs 26.211 µs]
                        change: [-5.5845% -5.3729% -5.1792%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe

inverse (c wrapper)/default
                        time:   [45.061 µs 45.141 µs 45.227 µs]
                        change: [+0.3738% +0.6326% +0.8919%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe

inverse (rust impl)/default
                        time:   [67.739 µs 67.796 µs 67.865 µs]
                        change: [-3.2442% -3.0580% -2.8479%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low severe
  5 (5.00%) low mild
  2 (2.00%) high mild
  3 (3.00%) high severe