donkirkby/live-py-plugin

Set willReadFrequently attribute of HTML canvas

donkirkby opened this issue · 1 comments

What I did

Refresh the Matplotlib intro tutorial with Ctrl+F5 and the console window open.

What happened

Saw a warning in the console:

Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

Timing of Romania tutorial after I made matplotlib optional:

  • localhost after F5
    • Total 5.57 +/- 0.42s 19.8MB data transferred

Timing of Matplotlib intro:

  • localhost after F5
    • Total 9.97 +/- 0.16s 41.2MB data transferred

Timing of Romania tutorial after I made willReadFrequently true:

  • localhost after F5
    • Total 5.38 +/- 0.03s 19.8MB data transferred

Timing of Matplotlib intro:

  • localhost after F5
    • Total 10.14 +/- 0.10s 41.2MB data transferred

So there's no significant change to the timing, but the warning went away. I guess I'll keep the change.