-
-
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
More optimization for cartesian subplots #2487
Conversation
- 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
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'); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
src/plot_api/subroutines.js
Outdated
plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, 'rect', 'bg'); | ||
pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]); | ||
} else { | ||
plotgroupBg = plotgroup.select('rect,bg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rect.bg
perhaps?
There was a problem hiding this comment.
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 😡
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 5307125
src/plot_api/subroutines.js
Outdated
pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]); | ||
} else { | ||
plotgroupBg = plotgroup.select('rect,bg'); | ||
if(plotgroupBg.size()) plotgroupBg.remove(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice find!
Fantastic- really whittling down the overhead! 💃 🐎 |
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.