-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve Heatmap rendering performance when zsmooth is false #6573
Comments
Thanks @lvlte - this is a great idea, the main constraint here is we need to detect whether the browser supports |
@alexcjohnson I'm about to submit a PR but yes I should have started with this (the browser support detection is not part of the PR yet - and I hope the detection is feasible without all of this ending too hackish). Do you know if there is a browser feature detection utility used somewhere in the project, something that i could reuse ? Or is the idea already too hackish ? [EDIT] : In fact this trick is already used for image traces, the var unsupportedBrowsers = Lib.isIOS() || Lib.isSafari() || Lib.isIE(); var supportsPixelatedImage = !(unsupportedBrowsers || gd._context._exportedPlot); var realImage = (
((trace.zsmooth === 'fast') || (trace.zsmooth === false && supportsPixelatedImage)) &&
!trace._hasZ && trace._hasSource && xa.type === 'linear' && ya.type === 'linear'
);
trace._realImage = realImage; var style = (trace.zsmooth === false) ? constants.pixelatedStyle : ''; image3.attr('style', style); And a list of values to apply : I was thinking about something a bit more specific, maybe using |
The idea is to use the zsmooth="fast" rendering method, which is currently faster than without smoothing (imageData pixel array vs fillRect), whenever possible, and tell the browser to not interpolate when zsmooth is false.
The condition is that all bricks should be uniform (ie. linear axes, linear scales, no gaps), so the proposition doesn't come as a replacement for the fillRect loop.
Here is a codepen that illustrates what I mean.
The performance gain becomes significant when used with sliders, as discussed here, and here.
The text was updated successfully, but these errors were encountered: