-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
feat: simplified caching for text #11505
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
Conversation
Simplifies caching for text by using unique identifiers and reference counting, reducing unnecessary texture regeneration and improving performance. - Introduces a unique identifier for TextStyle instances. - Implements reference counting for text textures to manage reuse. - Removes redundant key generation logic.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a8785a3:
|
pixi.js-base • pixi.js-bunny-mark
commit: |
Adds a cache to store measured text layouts, avoiding redundant recalculations and significantly improving performance when rendering the same text multiple times. Adds a unique identifier to bitmap fonts for cache invalidation purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should either use a getter for styleKey
or rename the function to getStyleKey
to remove any ambiguity.
I would be happy to merge in
right now 👍 Not against the additional caching on text - its just a lot of code to add back in and want to make sure it justifies the use cases! |
Hey guys. Thank you for your work. When can we expect the release of this feature? Text objects are integral part of my app. I just want to know whether should I implement the caching of text textures myself if this PR will take more time to merge, or it is reasonable to wait for the release. |
Hey, we are planning on getting this in for the next release, which should happen next week |
Awesome! |
Reintroducing the caching logic for text we had in Pixi <= 8.9, but with a new, simplified approach.
Key Changes:
Simplified Caching Mechanism:
This new implementation removes the somewhat fragile style-key tracking logic. Instead, it uses a much simpler
uid + tick
system to manage cached textures.This reduces the code complexity while still providing the benefits of texture caching when reusing the same text style.
For example, this would address use cases like #11465.