Skip to content

[WIP] Various render and event loop optimizations to share#483

Draft
ironfroggy wants to merge 2 commits into
ppb:canonfrom
ironfroggy:loop-optimizations
Draft

[WIP] Various render and event loop optimizations to share#483
ironfroggy wants to merge 2 commits into
ppb:canonfrom
ironfroggy:loop-optimizations

Conversation

@ironfroggy

Copy link
Copy Markdown
Contributor

Not intended as a mergeable pull request (yet?) but a starting point for conversations on event and render loop design.

All these changes got my ~1000 sprite prototype from ~40 fps to ~100 fps

@ironfroggy
ironfroggy requested a review from a team as a code owner May 24, 2020 16:49
Comment thread ppb/assetlib.py
logger.warning(f"Waited on {self!r} outside of the engine")
return self._future.result(timeout)
try:
return self._cached_result

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should benchmark this independently. We used to do something like this in Vector and found just doing the work was cheaper than the cost of the look-ups.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely would want to benchmark this, but I will at least point out that in any case where we want to cache something doing it with a try/except block is cheaper than a lookup followed by a calculation because it incurs 0 costs on the hit branch. The try-except variant does not have a cost of look-ups, necessarily.

@pathunstrom
pathunstrom changed the base branch from master to canon June 27, 2020 11:02
@pathunstrom

Copy link
Copy Markdown
Collaborator

Noting I'm looking to start poking the various optimizations here and we can start breaking this into separate changes.

@AstraLuma
AstraLuma marked this pull request as draft August 13, 2020 00:36
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