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

Add an experimental framesetter cache in ASTextNode2 #1063

Merged
merged 5 commits into from
Aug 4, 2018

Conversation

Adlai-Holler
Copy link
Member

Motivation

Creating framesetters is a very expensive operation. During multipass layout we create multiple framesetters for the same attributed string. And then if none of those layouts is actually selected, we create another one for the layout used for rendering. Cache them to improve performance.

Changes

  • Make a new experiment exp_framesetter_cache which reuses framesetters in an NSCache.
  • Make a raw-pointer set and a lock, to track which framesetters are busy.
    • If the cached framesetter for the target string is busy, we just create one and discard it. In practice this is unlikely and hasn't happened in testing.

@TextureGroup TextureGroup deleted a comment Aug 2, 2018
@TextureGroup TextureGroup deleted a comment Aug 2, 2018
@TextureGroup TextureGroup deleted a comment Aug 2, 2018
Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

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

Nice!

@Adlai-Holler Adlai-Holler merged commit b136e84 into master Aug 4, 2018
@Adlai-Holler Adlai-Holler deleted the AHReuseFramesetter branch August 4, 2018 14:33
mikezucc pushed a commit to mikezucc/Texture that referenced this pull request Oct 2, 2018
* Add an experimental framesetter cache in ASTextNode2, and stop keeping framesetters around

* Update configuration schema

* Fix imports

* Fix import again and remove set statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants