Skip to content

Boost performance of groups with blend_mode != PassThrough #1269

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

Merged
merged 8 commits into from
Jun 15, 2025

Conversation

Variable-ind
Copy link
Contributor

@Variable-ind Variable-ind commented Jun 11, 2025

NOTE: This is a performance PR so this would need a little testing, also it should be merged after Pixelorama 1.1.2 gets released (just a preference, not a requirement)

Attempt at solving #1250. Boosts the performance of GroupLayers to roughly twice (47% to be precise) it's current state by introducing cache.

  • In consecutive generations, when the shader is same, calling RenderingServer.material_set_shader again and again (in generate_image()) takes up unnecessary computation time (Which makes up most of the 47% time i talked about -- per generation). There is now a way to reuse the material in last generation for the next one.

  • when a GroupLayer gets blended, if it has another GroupLayer as child, even if the contents of child GroupLayer didn't change, it ends up being re-blended regardless. To fix this there is now a cache which save time if the contents of a GroupLayer didn't change.

As it uses cache this takes up a little more memory but it's not noticeable.

Copy link
Member

@OverloadedOrama OverloadedOrama left a comment

Choose a reason for hiding this comment

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

I tested it a bit and it works well. I think it should be fine to get merged for v1.1.2, it's a very welcome performance boost and it doesn't seem to be breaking anything. Thank you very much!

@OverloadedOrama OverloadedOrama merged commit e1e4788 into Orama-Interactive:master Jun 15, 2025
4 checks passed
@Variable-ind Variable-ind deleted the boost-groups branch June 15, 2025 10:50
@Variable-ind Variable-ind restored the boost-groups branch June 17, 2025 16:13
@Variable-ind Variable-ind deleted the boost-groups branch June 17, 2025 16:13
OverloadedOrama added a commit that referenced this pull request Jun 17, 2025
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