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
getCover_default @ d3-hexgrid.js?v=5cd79255:1213
(anonymous) @ d3-hexgrid.js?v=5cd79255:1389
hexgrid @ d3-hexgrid.js?v=5cd79255:1388
...
Looking into your code, by modifying /getImageData.js on line 22 from:
Hello,
I found a warning message from the console:
Looking into your code, by modifying
/getImageData.js
on line 22 from:const context = canvas.getContext('2d');
to:
const context = canvas.getContext('2d', { willReadFrequently: true });
The same was applied in
/getEdgeTools.js
. This has led to big performance improvement (>10x) for a world map with a radius of 3.I'll let you try and see if it's a good solution that should be applied.