- Notifications
You must be signed in to change notification settings - Fork3.8k
scale(), scale_by(), smoothscale(), smoothscale_by() reorganization and speed up#3319
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…o function.transform.smoothscale() and transform.smoothscale_by() now use internal C smoothscale_to function.
Removed unused variable
Starbuck5 commentedAug 10, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I didn't measure much of a performance difference at all, I guess this is more of a code quality PR 🙂 Maybe 1.5% better performance in some cases, but the benchmarks are shaky. (Although I've just realized I did test with a large surface, so differences may be masked.) |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
Besides my formatting nitpicks, this PR looks good to me. It's hard to review though, since the diff is so gnarly. (Not your fault)
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.
Had a quick look over the code and it looks reasonable with a bit less duplication.
The tests pass and as far as I can tell it has made little to no difference to performance.
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.
Thanks!
As a final check to make sure outputs hadn't changed, I scaled and smoothscaled a surface into a png file before and after, and verified the file hash hadn't changed.
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.
Very nice. 👍
It's common to see different speeds depending on image size and CPU cache size/architecture.
ps, as an aside; have you seehttps://halide-lang.org/ andhttps://github.com/pydata/numexpr ? The videos that halide provides are especially interesting.
Uh oh!
There was an error while loading.Please reload this page.
Implements#3315.
Results are a bit strange, but the functions do work. I used this code:
and got these results:
OLD
NEW