-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardized to usize #57
Conversation
Remove instances of i64 & isize when indexing, standardized on usize
Could you run |
Squashing locally broke because of the upstream commits, idk how to fix that. Clippy demanded I do a lot of things outside of the scope of the original change |
const COEFF: [f64; 18] = [ | ||
-1.0, 6.0, -16.0, 32.0, -9.0, 64.0, -128.0, 2048.0, 9.0, -16.0, 768.0, 3.0, -5.0, 512.0, | ||
-7.0, 1280.0, -7.0, 2048.0, | ||
]; | ||
let eps2 = sq(eps); | ||
let mut d = eps; | ||
let mut o = 0; | ||
for l in 1..=geodesic_order { | ||
for (l, v) in c.iter_mut().enumerate().take(geodesic_order + 1).skip(1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we can really consider this line an improvement in aggregate, but who am I to argue with a paperclip? 😆
Hmmm, I'm actually seeing a perf regression with this PR
If I revert the clippy/format commit (877afcc) I see both an improvement and a regression:
Any idea why? |
My best guess is the change is within the noise threshold. I commonly see +/-3µs changes without a code change locally (even with I've taken steps to try to reduce this noise (closing applications, changing cpu throttling/power options) but it remains frustratingly common result. |
Noise is a real thing, but the consistency with which I can reproduce the relative behavior leads me to believe this is not only noise in the benchmark.
Are you able to reproduce this? |
The regressions from the clippy/fmt commit seem to be from changing the loop iteration. e.g. this branch https://github.com/georust/geographiclib-rs/tree/mkirk/usize (as of 20a2b33) has the same perf characteristics as before your clippy changes. That is:
|
Thanks! I included this in #58 (but reverted part of the clippy changes). |
Sort of... Looking at the ASM output link The main different I see is the normal index based loop does a pretty simple structure
While the clippy version does
This makes the clippy version extremely branch heavy, as it seems to frequently branch off check a bunch of stuff, then return to the inner loop. |
Interesting! That might account for it. |
Remove instances of i64 & isize when indexing, standardized on usize
CHANGES.md
if knowledge of this change could be valuable to users.Per #56 (comment)
Attempting to reducing the scope of the PR.
This only addresses moving indexing variables to
usize
.