Skip to content

SP5: Fix typeface caching#3334

Merged
swharden merged 4 commits intoScottPlot:mainfrom
Milkitic:fix/caching-typeface
Feb 19, 2024
Merged

SP5: Fix typeface caching#3334
swharden merged 4 commits intoScottPlot:mainfrom
Milkitic:fix/caching-typeface

Conversation

@Milkitic
Copy link
Contributor

@Milkitic Milkitic commented Feb 2, 2024

Fixes: #3335

Checked #2848 and #2419, but it seems that the issue is not actually fixed in the latest branch.
It causes critical performance issues in Linux systems.
In KUbuntu 23.10 with Avalonia 11.0.7 , the problem still exists as below:

Screenshot_20240202_105303

After fixing:

Screenshot_20240202_140558

Just simply modifed the code to reach the caching goals:

// public SKTypeface Typeface => CachedTypeface ?? CreateTypeface(Name, Bold, Italic); // broken
public SKTypeface Typeface => CachedTypeface ??= CreateTypeface(Name, Bold, Italic); // works

@swharden
Copy link
Member

Great catch @Milkitic, thanks so much for my fix! I was sick for a few weeks and got behind on issues and PRs, but I'm happy to be merging this in now. Thanks again!

@swharden swharden merged commit 6ebc661 into ScottPlot:main Feb 19, 2024
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.

SP5: Typeface was not actually cached (Critical Performance Issue)

2 participants