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

More optimization for cartesian subplots #2487

Merged
merged 6 commits into from
Mar 26, 2018

Conversation

etpinard
Copy link
Contributor

to be more merged in #2474

In progress for now, as I'll try to speed up a few more things in the coming days.

- this can speed up Axes.doTicks by 50ms on 50x50 subplots grids
- so that drawTitle() can reuse it
- this can speed up doTicks by 200ms at 50x50 subplots
@etpinard etpinard added this to the v1.36.0 milestone Mar 20, 2018
@etpinard
Copy link
Contributor Author

I was hoping to improve a few more things in this PR, namely:

but I'll have to leave that for later.


@alexcjohnson would mind taking a 👀 at this?

@@ -347,7 +347,7 @@ exports.plot = function(gd, data, layout, config) {

// draw ticks, titles, and calculate axis scaling (._b, ._m)
function drawAxes() {
return Axes.doTicks(gd, 'redraw');
return Axes.doTicks(gd, graphWasEmpty ? '' : 'redraw');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK... this is the only caller using doTicks(gd, '') right? From the logic below it looks like there may have been one previously (or someone just calling doTicks(gd)) but I don't see it now. I'm a little reticent to add new branches inside doTicks when what we really need to do is unpack it into more digestible pieces - but that's probably a project for another time refactoring all of axes.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK... this is the only caller using doTicks(gd, '') right? From the logic below it looks like there may have been one previously (or someone just calling doTicks(gd)) but I don't see it now.

That's correct.

plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, 'rect', 'bg');
pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]);
} else {
plotgroupBg = plotgroup.select('rect,bg');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rect.bg perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I guess that means we have some untested code branches in there 😡

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have some untested code branches in there

maybe, maybe not. rect,bg would delete all rect elements (are there any others? if not, then what you have there will work, it just won't be as efficient) and all bg elements (which don't exist)

Copy link
Contributor Author

@etpinard etpinard Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😌 yeah you're right,

image

this thing ⤴️ fails when commenting out this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 5307125

pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]);
} else {
plotgroupBg = plotgroup.select('rect,bg');
if(plotgroupBg.size()) plotgroupBg.remove();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this if make a difference? Does it take a non-negligible time to remove an empty selection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that if did not improve things -> 🔪 in 5307125

var avoid = {
selection: avoidSelection,
selection: tickLabels,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find!

@alexcjohnson
Copy link
Collaborator

Fantastic- really whittling down the overhead! 💃 🐎

@etpinard etpinard merged commit 50ab638 into perf-drawFramwork Mar 26, 2018
@etpinard etpinard deleted the perf-drawFramwork-more branch March 26, 2018 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants