Skip to content
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

Aggressive splom perf #3057

Merged
merged 30 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
56f2ee9
update scattergl & splom 'text' attr description
etpinard Sep 18, 2018
3574ece
move splom scene ref to fullLayout
etpinard Sep 27, 2018
8d0cac5
use styleOnSelect for scatter[polar]gl and splom
etpinard Sep 27, 2018
8282d91
compute marker.size axis 'ppad' value once per splom traces,
etpinard Sep 27, 2018
73acd7e
merge options before matrix.update call
etpinard Sep 27, 2018
cc5f0ca
speed up 'axrange' edits
etpinard Sep 27, 2018
17e30d2
aggressively try to speed 'axrange' edits for splom
etpinard Sep 27, 2018
4792f08
optimize lsInner for splom
etpinard Sep 27, 2018
f415e96
first-cut editType:'style' pathway for sploms
etpinard Sep 27, 2018
3eb91c0
no need to re-calc 'regl' traces in-and-out of arrayOk values
etpinard Sep 27, 2018
145cad3
try implementing a fast 'markerSize' editType
etpinard Sep 27, 2018
6de1ae4
add supplyDefaults bypass 'axrange' optimization to Plotly.update
etpinard Oct 1, 2018
aaf6312
apply no-need-for-<rect.bg> optimization to all cartesian subplots
etpinard Oct 1, 2018
478c669
speed up splom.clean
etpinard Oct 1, 2018
81eb48b
introduce redrawReglTraces subroutine
etpinard Oct 2, 2018
0243451
:hocho: obsolete sortBasePlotModules
etpinard Oct 2, 2018
dcacd78
use redrawReglTraces on drag
etpinard Oct 2, 2018
68dfbc1
use redrawReglTraces on polar drag
etpinard Oct 2, 2018
c02330c
fix #2797 - clear full canvas and use redrawReglTraces on selections
etpinard Oct 2, 2018
02263b9
use redrawReglTraces in edit subroutines
etpinard Oct 2, 2018
f179c2f
skip canvas/context size mismatch test on CI
etpinard Oct 2, 2018
cd8d8ab
Merge pull request #3067 from plotly/redraw-regl-traces-subroutine
etpinard Oct 2, 2018
0aad7ea
fixup (add missing @gl)
etpinard Oct 2, 2018
078c086
clear axis types when restyling splom show(upper|lower)half
etpinard Oct 2, 2018
00cae48
Revert "clear axis types when restyling splom show(upper|lower)half"
etpinard Oct 3, 2018
5878223
make trace `(x|y)axes` always have the same length dimensions`
etpinard Oct 4, 2018
c2ecb3a
:hocho: obsolete args
etpinard Oct 4, 2018
31d5606
fixup comments
etpinard Oct 4, 2018
ea38664
add noCI tag to misbehaving tests
etpinard Oct 4, 2018
4137433
place splom axes on bottom/left sides when just diagonal is missing
etpinard Oct 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ function _hover(gd, evt, subplot, noHoverEvent) {
if(fullLayout[subplotId]) {
pointData.subplot = fullLayout[subplotId]._subplot;
}
// add ref to splom scene
if(fullLayout._splomScenes && fullLayout._splomScenes[trace.uid]) {
pointData.scene = fullLayout._splomScenes[trace.uid];
}

closedataPreviousLength = hoverData.length;

Expand Down
5 changes: 3 additions & 2 deletions src/plot_api/edit_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var isPlainObject = Lib.isPlainObject;
var traceOpts = {
valType: 'flaglist',
extras: ['none'],
flags: ['calc', 'clearAxisTypes', 'plot', 'style', 'colorbars'],
flags: ['calc', 'clearAxisTypes', 'plot', 'style', 'markerSize', 'colorbars'],
description: [
'trace attributes should include an `editType` string matching this flaglist.',
'*calc* is the most extensive: a full `Plotly.plot` starting by clearing `gd.calcdata`',
Expand All @@ -24,7 +24,8 @@ var traceOpts = {
'cause the automatic axis type detection to change. Log type will not be cleared, as that',
'is never automatically chosen so must have been user-specified.',
'*plot* calls `Plotly.plot` but without first clearing `gd.calcdata`.',
'*style* only calls `module.style` for all trace modules and redraws the legend.',
'*style* only calls `module.style` (or module.editStyle) for all trace modules and redraws the legend.',
'*markerSize* is like *style*, but propagate axis-range changes due to scatter `marker.size`',
'*colorbars* only redraws colorbars.'
].join(' ')
};
Expand Down
66 changes: 48 additions & 18 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ exports.plot = function(gd, data, layout, config) {
Lib.error(msg);
} else {
Lib.log(msg + ' Clearing graph and plotting again.');
Plots.cleanPlot([], {}, gd._fullData, fullLayout, gd.calcdata);
Plots.cleanPlot([], {}, gd._fullData, fullLayout);
Plots.supplyDefaults(gd);
fullLayout = gd._fullLayout;
Plots.doCalcdata(gd);
Expand Down Expand Up @@ -614,7 +614,7 @@ exports.newPlot = function(gd, data, layout, config) {
gd = Lib.getGraphDiv(gd);

// remove gl contexts
Plots.cleanPlot([], {}, gd._fullData || [], gd._fullLayout || {}, gd.calcdata || []);
Plots.cleanPlot([], {}, gd._fullData || [], gd._fullLayout || {});

Plots.purge(gd);
return exports.plot(gd, data, layout, config);
Expand Down Expand Up @@ -1344,8 +1344,21 @@ exports.restyle = function restyle(gd, astr, val, _traces) {
} else {
seq.push(Plots.previousPromises);

// maybe only call Plots.supplyDataDefaults in the splom case,
// to skip over long and slow axes defaults
Plots.supplyDefaults(gd);

if(flags.markerSize) {
Plots.doCalcdata(gd);
addAxRangeSequence(seq);

// TODO
// if all axes have autorange:false, then
// proceed to subroutines.doTraceStyle(),
// otherwise we must go through addAxRangeSequence,
// which in general must redraws 'all' axes
}

if(flags.style) seq.push(subroutines.doTraceStyle);
if(flags.colorbars) seq.push(subroutines.doColorBars);

Expand Down Expand Up @@ -1572,8 +1585,10 @@ function _restyle(gd, aobj, traces) {
else {
if(valObject) {
// must redo calcdata when restyling array values of arrayOk attributes
if(valObject.arrayOk && (
Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))
// ... but no need to this for regl-based traces
if(valObject.arrayOk &&
!Registry.traceIs(contFull, 'regl') &&
(Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))
) {
flags.calc = true;
}
Expand Down Expand Up @@ -1701,15 +1716,11 @@ exports.relayout = function relayout(gd, astr, val) {
seq.push(subroutines.layoutReplot);
}
else if(Object.keys(aobj).length) {
Plots.supplyDefaults(gd);
axRangeSupplyDefaultsByPass(gd, flags, specs) || Plots.supplyDefaults(gd);

if(flags.legend) seq.push(subroutines.doLegend);
if(flags.layoutstyle) seq.push(subroutines.layoutStyles);

if(flags.axrange) {
addAxRangeSequence(seq, specs.rangesAltered);
}

if(flags.axrange) addAxRangeSequence(seq, specs.rangesAltered);
if(flags.ticks) seq.push(subroutines.doTicksRelayout);
if(flags.modebar) seq.push(subroutines.doModeBar);
if(flags.camera) seq.push(subroutines.doCamera);
Expand All @@ -1733,13 +1744,35 @@ exports.relayout = function relayout(gd, astr, val) {
});
};

// Optimization mostly for large splom traces where
// Plots.supplyDefaults can take > 100ms
function axRangeSupplyDefaultsByPass(gd, flags, specs) {
var k;

if(!flags.axrange) return false;

for(k in flags) {
if(k !== 'axrange' && flags[k]) return false;
}

for(k in specs.rangesAltered) {
var axName = Axes.id2name(k);
var axIn = gd.layout[axName];
var axOut = gd._fullLayout[axName];
axOut.autorange = axIn.autorange;
axOut.range = axIn.range.slice();
axOut.cleanRange();
}
return true;
}

function addAxRangeSequence(seq, rangesAltered) {
// N.B. leave as sequence of subroutines (for now) instead of
// subroutine of its own so that finalDraw always gets
// executed after drawData
var doTicks = rangesAltered ?
function(gd) { return subroutines.doTicksRelayout(gd, rangesAltered); } :
subroutines.doTicksRelayout;
function(gd) { return Axes.doTicks(gd, Object.keys(rangesAltered), true); } :
function(gd) { return Axes.doTicks(gd, 'redraw'); };
alexcjohnson marked this conversation as resolved.
Show resolved Hide resolved

seq.push(
subroutines.doAutoRangeAndConstraints,
Expand Down Expand Up @@ -2156,15 +2189,13 @@ exports.update = function update(gd, traceUpdate, layoutUpdate, _traces) {
}
else {
seq.push(Plots.previousPromises);
Plots.supplyDefaults(gd);
axRangeSupplyDefaultsByPass(gd, relayoutFlags, relayoutSpecs) || Plots.supplyDefaults(gd);

if(restyleFlags.style) seq.push(subroutines.doTraceStyle);
if(restyleFlags.colorbars) seq.push(subroutines.doColorBars);
if(relayoutFlags.legend) seq.push(subroutines.doLegend);
if(relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);
if(relayoutFlags.axrange) {
addAxRangeSequence(seq, relayoutSpecs.rangesAltered);
}
if(relayoutFlags.axrange) addAxRangeSequence(seq, relayoutSpecs.rangesAltered);
if(relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);
if(relayoutFlags.modebar) seq.push(subroutines.doModeBar);
if(relayoutFlags.camera) seq.push(subroutines.doCamera);
Expand Down Expand Up @@ -3168,10 +3199,9 @@ exports.purge = function purge(gd) {

var fullLayout = gd._fullLayout || {};
var fullData = gd._fullData || [];
var calcdata = gd.calcdata || [];

// remove gl contexts
Plots.cleanPlot([], {}, fullData, fullLayout, calcdata);
Plots.cleanPlot([], {}, fullData, fullLayout);

// purge properties
Plots.purge(gd);
Expand Down
Loading