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

Cache the font information #8537

Merged
merged 3 commits into from
Feb 2, 2020
Merged

Cache the font information #8537

merged 3 commits into from
Feb 2, 2020

Conversation

fredj
Copy link
Contributor

@fredj fredj commented Jan 14, 2020

This is a pull request to improve to label performances.

Instead of parsing the font for each label, a cache is used to store the information.
Adding an element to the dom and calling getComputedStyle forces a reflow and is bad for the performance.

The cache is just and object and is never cleared because I've assumed the it won't get very big.

Thoughts?

@cesium-concierge
Copy link

Thanks for the pull request @fredj!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@fredj fredj force-pushed the cache_font_info branch 2 times, most recently from ed2e341 to b7d43b2 Compare January 16, 2020 07:43
@hpinkos
Copy link
Contributor

hpinkos commented Jan 29, 2020

@lilleyse or @IanLilleyT can you review this?

@lilleyse
Copy link
Contributor

@fredj I think I'm good with this change even if the cache doesn't get cleared. There was a similar discussion here about clearing the cache, are any of those ideas actionable?

@fredj
Copy link
Contributor Author

fredj commented Jan 29, 2020

@lilleyse What about 8060c3a? only the first 256 fonts are saved into the cache

Source/Scene/Label.js Outdated Show resolved Hide resolved
@lilleyse
Copy link
Contributor

lilleyse commented Feb 2, 2020

Thanks @fredj!

@lilleyse lilleyse merged commit 1359e3f into CesiumGS:master Feb 2, 2020
@lilleyse
Copy link
Contributor

lilleyse commented Feb 2, 2020

I updated CHANGES.md in 5cc6fa6

@fredj fredj deleted the cache_font_info branch February 3, 2020 07:41
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.

4 participants