-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Misc performance optimization #1585
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,7 +282,8 @@ Plotly.plot = function(gd, data, layout, config) { | |
// Now plot the data | ||
function drawData() { | ||
var calcdata = gd.calcdata, | ||
i; | ||
i, | ||
rangesliderContainers = fullLayout._infolayer.selectAll('g.rangeslider-container'); | ||
|
||
// in case of traces that were heatmaps or contour maps | ||
// previously, remove them and their colorbars explicitly | ||
|
@@ -302,7 +303,7 @@ Plotly.plot = function(gd, data, layout, config) { | |
.selectAll(query) | ||
.remove(); | ||
|
||
fullLayout._infolayer.selectAll('g.rangeslider-container') | ||
rangesliderContainers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. How does this result in a perf improvement? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did not tested separately. Just checked and my tests shows 200ms to 400ms improvement on 200 traces. When I profile the 200-trace case, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. I understand the value of caching selections, but here you're just assigning the selection to a variable: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Ha. Now I see it (it isn't part of the GH diff view). Thanks 👍 |
||
.selectAll(query) | ||
.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.
Nicely done. There's only one tester div per page, so might as well cache in the
Drawing
module object. 👍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.
Not sure if I understand correctly. I did cache the tester div in line 517 and 518 already. Is that what you are referring to?
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.
I'm saying this is a great commit.
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.
Got used to expect modification suggestions in a code review lol. Thanks!