-
Notifications
You must be signed in to change notification settings - Fork 0
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
Simplify bilinear interpolation #132
Comments
Yes I realize that. But as I documented:
And I doubt that any platform's optimization is so bad that this will result in any performance improvement. |
I'm resistant to changing this. I'm so used to seeing the form that's currently implemented in the code, and I suspect others might be too, so I'm not at all on board with the "easier to grok" argument. There's no evidence that changing it will result in any performance increase. And I'll need to spend time making the change and regression testing. I'll give @samreid one more opportunity to sell me on this. Why should I change this? |
I trust your judgment and no changes are necessary here. I wrote this issue because, as an outsider seeing that code for the first time, this part looked overly complex and difficult to understand. My proposal was one idea that was easier for me to understand, to make the code look less overwhelming. Up to you if you want to do anything here. |
Cool. I'm going to leave it as is. |
During code review #103 we observed this bilinear interpolation code:
Please note several quantities are repeated in this expression. Furthermore, note that x1-x0 and y1-y0 are simply the spacing because of the definition of x0,x1,y0 and y1:
Therefore, the bilinear calculation can be written as:
This simplification makes it easier to grok and see the symmetries.
We observed that dragging the magnet around on screen 1 for 10 seconds ended up calling this method 904544 times. However, on macOS 14.2.1 running chrome Version 123.0.6312.59 (Official Build) (arm64) and firefox 124.0.1 (64-bit), the optimized version did not show faster performance. We did not compare performance of the algorithms on chromebooks or ipads.
In our opinion, having a simpler, easier to grok implementation where the symmetries are clear is more valuable than matching the form typically shown in references. We also recommend unit tests to guarantee the behavior, see #131
The text was updated successfully, but these errors were encountered: