Use OffscreenCanvas when available#27
Merged
borgar merged 1 commit intoborgar:masterfrom Sep 1, 2022
flother:offscreencanvas
Merged
Use OffscreenCanvas when available#27borgar merged 1 commit intoborgar:masterfrom flother:offscreencanvas
borgar merged 1 commit intoborgar:masterfrom
flother:offscreencanvas
Conversation
A Google Chrome Developers session from 2019 states that OffscreenCanvas has better performance than <canvas> even when it's running on the main thread. Their benchmarks showed that: - OffscreenCanvas is 50% faster at creation - Text operations on OffscreenCanvas are 15--45% faster. The second benchmark is of the most value to this library. It's a bit of a micro-optimisation, but it will have benefits if a lot of text measurement is going on. <https://youtu.be/ePaUrMCL7g4?t=246> OffscreenCanvas is available in Chrome and Edge (since 2018 and 2020 respectively). Other browsers will continue to use <canvas> to measure text.
borgar
approved these changes
Sep 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Google Chrome Developers session from 2019 states that
OffscreenCanvashas better performance than<canvas>even when it's running on the main thread. Their benchmarks showed that:OffscreenCanvasis 50% faster at creationOffscreenCanvasare 15–45% faster.The second benchmark is of the most value to this library. It's a bit of a micro-optimisation, but it will have benefits if a lot of text measurement is going on.
OffscreenCanvasis available in Chrome and Edge (since 2018 and 2020 respectively). Other browsers will continue to use<canvas>to measure text.