Skip to content
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

Try to optimize proxy_func #507

Merged
merged 4 commits into from
May 28, 2024
Merged

Try to optimize proxy_func #507

merged 4 commits into from
May 28, 2024

Conversation

almarklein
Copy link
Member

@almarklein almarklein commented May 27, 2024

In benchmarking for pygfx/pygfx#763 it looked like the proxy_func is called a lot, so I figured that of it could be optimized it would be an easy win. It looks like the result is not really measurable, but nevertheless might be worth applying.

  • Use a deque instead of a list.
  • Move the capturing logic to the ErrorHandler class, so that the logic in the proxy_func becomes simpler. Also cleaner code imo.
  • The above also means that the proxy_func closure only captures the error_handler object and no longer uses self.

@almarklein almarklein requested a review from Korijn as a code owner May 27, 2024 10:23
@almarklein
Copy link
Member Author

BTW: I tried to find other areas for improving performance. One is that our glfw GUI backend consumes a bit more CPU than Qt, because of the custom event-loop to keep the windows alive. This can be refactored to use asyncio to do more of the scheduling. But let's do this when we work on #355 / #383 / update modes.

@almarklein
Copy link
Member Author

BTW, a Cython-based wrapper for wgpu-native might provide obsevable performance improvement :)

@Korijn Korijn merged commit 684e0d2 into main May 28, 2024
20 checks passed
@Korijn Korijn deleted the proxy_func branch May 28, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants