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

Draw-cache: Optimise empty cache-queued into single texture upload #121

Merged
merged 3 commits into from
Sep 26, 2020

Conversation

alexheretic
Copy link
Owner

This PR adds an optimisation targeting whenever the cache is empty & multiple new glyphs have been drawn in a call to cache_queued, e.g. the initial population of the cache & when it must be re-orded to fit all glyphs after a change.

In this case total in-use region of the texture will be saved in memory during the cache_queued(self, fonts, uploader) call and provided with a single callback to uploader. This minimises uploads to the gpu in common cases which should be faster.

cache_queued calls to a non-empty cache are not effected.

Benchmarks

The draw-cache v2 benchmarks simulate gpu uploads by busy waiting for 4us, this allows us to benchmark this improvement in a artificial way.

Non-populating benchmarks were not effected, as expected. Populating & reordering benchmarks were:

  • multi_font_population_v2 -63.5%
  • resizing_v2 -59.1%
  • moving_text_thrashing_v2 -58.3%

Related to discussion in #120

@alexheretic
Copy link
Owner Author

@AlexCharlton I wonder how this change will perform in your profiled 100-glyph population use case, an improvement I'd hope?

@alexheretic alexheretic merged commit 1a8f496 into master Sep 26, 2020
@alexheretic alexheretic deleted the single-initial-upload branch September 26, 2020 10:49
@AlexCharlton
Copy link

I should have some time to do some more profiling this weekend, but I'm positive this change will affect that first-load time test positively :)

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