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 1 commit
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: 2 additions & 2 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1738,8 +1738,8 @@ function addAxRangeSequence(seq, rangesAltered) {
// 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
8 changes: 2 additions & 6 deletions src/plot_api/subroutines.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,8 @@ exports.doLegend = function(gd) {
return Plots.previousPromises(gd);
};

exports.doTicksRelayout = function(gd, rangesAltered) {
if(rangesAltered) {
Axes.doTicks(gd, Object.keys(rangesAltered), true);
} else {
Axes.doTicks(gd, 'redraw');
}
exports.doTicksRelayout = function(gd) {
Axes.doTicks(gd, 'redraw');

if(gd._fullLayout._hasOnlyLargeSploms) {
clearGlCanvases(gd);
Expand Down
12 changes: 10 additions & 2 deletions test/jasmine/tests/plot_api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var Queue = require('@src/lib/queue');
var Scatter = require('@src/traces/scatter');
var Bar = require('@src/traces/bar');
var Legend = require('@src/components/legend');
var Axes = require('@src/plots/cartesian/axes');
var pkg = require('../../../package.json');
var subroutines = require('@src/plot_api/subroutines');
var helpers = require('@src/plot_api/helpers');
Expand Down Expand Up @@ -531,12 +532,14 @@ describe('Test plot api', function() {
mockedMethods.forEach(function(m) {
spyOn(subroutines, m);
});
spyOn(Axes, 'doTicks');
});

function mock(gd) {
mockedMethods.forEach(function(m) {
subroutines[m].calls.reset();
});
Axes.doTicks.calls.reset();

supplyAllDefaults(gd);
Plots.doCalcdata(gd);
Expand Down Expand Up @@ -634,7 +637,7 @@ describe('Test plot api', function() {
});

it('should trigger minimal sequence for cartesian axis range updates', function() {
var seq = ['doAutoRangeAndConstraints', 'doTicksRelayout', 'drawData', 'finalDraw'];
var seq = ['doAutoRangeAndConstraints', 'drawData', 'finalDraw'];

function _assert(msg) {
expect(gd.calcdata).toBeDefined();
Expand All @@ -644,6 +647,9 @@ describe('Test plot api', function() {
'# of ' + m + ' calls - ' + msg
);
});
expect(Axes.doTicks).toHaveBeenCalledTimes(1);
expect(Axes.doTicks.calls.allArgs()[0][1]).toEqual(['x']);
expect(Axes.doTicks.calls.allArgs()[0][2]).toBe(true, 'skip-axis-title argument');
}

var specs = [
Expand Down Expand Up @@ -2588,6 +2594,7 @@ describe('Test plot api', function() {
spyOn(annotations, 'drawOne').and.callThrough();
spyOn(annotations, 'draw').and.callThrough();
spyOn(images, 'draw').and.callThrough();
spyOn(Axes, 'doTicks').and.callThrough();
});

afterEach(destroyGraphDiv);
Expand Down Expand Up @@ -2823,10 +2830,11 @@ describe('Test plot api', function() {
Plotly.newPlot(gd, data, layout)
.then(countPlots)
.then(function() {
expect(Axes.doTicks).toHaveBeenCalledWith(gd, '');
return Plotly.react(gd, data, layout2);
})
.then(function() {
expect(subroutines.doTicksRelayout).toHaveBeenCalledTimes(1);
expect(Axes.doTicks).toHaveBeenCalledWith(gd, 'redraw');
expect(subroutines.layoutStyles).not.toHaveBeenCalled();
})
.catch(failTest)
Expand Down
78 changes: 78 additions & 0 deletions test/jasmine/tests/splom_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Plotly = require('@lib');
var Lib = require('@src/lib');
var Plots = require('@src/plots/plots');
var Axes = require('@src/plots/cartesian/axes');
var SUBPLOT_PATTERN = require('@src/plots/cartesian/constants').SUBPLOT_PATTERN;

var d3 = require('d3');
Expand Down Expand Up @@ -747,6 +748,83 @@ describe('Test splom interactions:', function() {
});
});

describe('Test splom update switchboard:', function() {
var gd;

beforeEach(function() {
gd = createGraphDiv();
});

afterEach(function() {
Plotly.purge(gd);
destroyGraphDiv();
});

var methods;

function addSpies() {
methods.forEach(function(m) {
var obj = m[0];
var k = m[1];
spyOn(obj, k).and.callThrough();
});
}

function assertSpies(msg, exp) {
methods.forEach(function(m, i) {
var obj = m[0];
var k = m[1];
var expi = exp[i];
expect(obj[k]).toHaveBeenCalledTimes(expi[1], expi[0]);
obj[k].calls.reset();
});
}

it('@gl should trigger minimal sequence for axis range updates (large splom case)', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/splom_large.json'));
var matrix, regl, splomGrid;

Plotly.plot(gd, fig).then(function() {
var fullLayout = gd._fullLayout;
var trace = gd._fullData[0];
var scene = fullLayout._splomScenes[trace.uid];
matrix = scene.matrix;
regl = matrix.regl;
splomGrid = fullLayout._splomGrid;

methods = [
[Plots, 'supplyDefaults'],
[Axes, 'doTicks'],
[regl, 'clear'],
[splomGrid, 'update']
];
addSpies();

expect(fullLayout.xaxis.range).toBeCloseToArray([-0.0921, 0.9574], 1, 'xrng (base)');

return Plotly.relayout(gd, 'xaxis.range', [0, 1]);
})
.then(function() {
var msg = 'after update';

assertSpies(msg, [
['supplyDefaults', 1],
['doTicks', 1],
['regl clear', 1],
['splom grid update', 1],
['splom grid draw', 1],
['splom matrix update', 1],
['splom matrix draw', 1]
]);

expect(gd.layout.xaxis.range).toBeCloseToArray([0, 1], 1, 'xrng ' + msg);
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0, 1], 1, 'xrng ' + msg);
})
.catch(failTest)
.then(done);
});
});

describe('Test splom hover:', function() {
var gd;

Expand Down