Skip to content

Add willReadFrequently to 2d canvas contexts, where appropriate. - #6084

Merged
archmoj merged 4 commits into
plotly:masterfrom
junov:add_willReadFrequently
Mar 24, 2022
Merged

Add willReadFrequently to 2d canvas contexts, where appropriate.#6084
archmoj merged 4 commits into
plotly:masterfrom
junov:add_willReadFrequently

Conversation

@junov

@junov junov commented Jan 19, 2022

Copy link
Copy Markdown
Contributor

This change adds the willReadFrequently:true 2d context creation
attribute to call sites where canvases will be read from (i.e
getImageData or toDataURL). This is a performance hint that tells
the browser to optimize for readbacks.

See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

The new API will soon be launched in chromium-based web browsers.

The objective of this change is to optimize performance and prevent
possible performance regressions when this new feature is launched
by major web browser in the near future.

junov added 2 commits January 19, 2022 13:48
This chang add the willReadFrequently:true 2d context creation
attribute to call sites where canvases will be read from (i.e
getImagData or toDataURL).  This is a performance hint that tells
the browser to optimize for readbacks.

See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

The new API will soon be launched in chromium-based web browsers.

The objective of this change is to optimize performance and prevent
possible performance regressions when this new feature is launched
by major web browser in the near future.
@archmoj archmoj added community community contribution status: reviewable labels Mar 23, 2022
Comment thread src/traces/image/plot.js Outdated
Comment thread draftlogs/6084_change.md Outdated
@archmoj

archmoj commented Mar 23, 2022

Copy link
Copy Markdown
Contributor

Thanks very much for the PR!
Looking good to me.
cc: @alexcjohnson

@alexcjohnson alexcjohnson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @junov - and @archmoj if you’re happy I’m happy 💃

@secretwpn

Copy link
Copy Markdown

Hi. I'm still getting browser warning about missing willReadFrequently hint in plotly 2.33.0
It looks like this is coming from regl-splom funciton getPad(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community community contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants