Skip to content

Optimize the render loop#201

Merged
sastraxi merged 19 commits into
mainfrom
perf/render-loop
Jul 17, 2026
Merged

Optimize the render loop#201
sastraxi merged 19 commits into
mainfrom
perf/render-loop

Conversation

@sastraxi

@sastraxi sastraxi commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

A few things were going wrong to make rendering a lot slower than it should have been:

  • tint_mask turned into a general-purpose, caching helper for alpha painting
  • a bunch of places refactored to use tint_mask
  • rounded rects are now cached
  • arc ring rewritten to be more efficient + cached
  • remove font.font_metrics and instead cache get_text_size / get_text_bbox
  • cache text drwaing
  • add batching so immediate draws can't race coalesced draws
  • coalesce new draws into pending pushes

As a result, the v2 is now much more usable and will have more CPU available for effects. However, the caches will use about 5-6 mb more RAM.

The snapshot changes are all small pixel alpha blending rounding changes; nothing visible has changed.

Finally, I removed all profiling code (was from a previous investigation and was never cleaned up).

@sastraxi
sastraxi requested a review from rreichenbach July 11, 2026 16:34

@rreichenbach rreichenbach left a comment

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.

Looks good.

@sastraxi
sastraxi changed the base branch from feat/v2-support to main July 17, 2026 22:49
@sastraxi
sastraxi merged commit 14c3961 into main Jul 17, 2026
2 checks passed
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