-
Notifications
You must be signed in to change notification settings - Fork 129
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
Performance improvements #16
base: master
Are you sure you want to change the base?
Conversation
This is fixing #10 as well. |
…so provide the correct item count to the sortedItems array list
TODO:
|
@FabianTerhorst Check out some of the recent branches i made in my fork of the repository, I tried out a few performance improvements that didn't end up being improvements. I found Java to be faster/better at allocating many small objects that eventually get garbage collected instead of performing object pooling. |
What im doing there isn't the same its just calculating the values in the loop before the intersection check happens n * n times. Its not caching any values accross multiple measurements. Colors are also very easy to calculate thats why i inlined the full logic there so that its getting full java jit optimization. |
I added a few more raycast algorithms for testing the performance differences. Currently i would prefer the new one 4b0b326#diff-7798cc0d3e9fcdd35a27e8e0f6febf5dR85 . |
have you tried caching the paint object with the associated color integer that got calculated from android.graphics.Color.argb? |
Instead of calculating the deltaX, deltaY and r for each item n*n times, it now calculates them n times. Also reduced the allocations by caching the transformed polymer instead of allocating it inside each interaction check.