Scales are measuring the longest text for all ticks including skipped…#5765
Scales are measuring the longest text for all ticks including skipped…#5765desean1625 wants to merge 2 commits intochartjs:masterfrom
Conversation
… ticks This causes a decrease in performance.
desean1625
left a comment
There was a problem hiding this comment.
Here is a codepen that Alerts the time it takes to load the chart. The first alert is the time it takes without the modification, the second is with the scales prototype mutated to include my changes.
https://codepen.io/desean1625/pen/aRVpdj
At least on my browser
Chromium
Version 69.0.3497.81 (Official Build) Built on Ubuntu , running on Ubuntu 18.04 (64-bit)
it is almost 50% less time.
FF 62.0 (64-bit) Similar results.
|
@desean1625 will you be able to take another look at this PR in order to call |
|
I have not. I will see if I can get some time to look at this again. |
|
After having spent some time working on the surrounding code and looking at this more, I'm worried this approach won't work because Chart.js/src/core/core.scale.js Line 633 in 2cdb2f8 So we can't call |
|
As one potential optimization, we are going to stop measuring the label sizes when |
|
I spent awhile working on this code and talking to the other maintainers about it on Slack. They suggested that the expected order of operations is that we first rotate the ticks and then we do the auto-skipping. I think that this PR doesn't really fit that expectation, which I tried to better document here: #6079. If you look at some of the PRs and issues that are linked to that one you can see more of the discussion that was had and also look in the Slack #dev channel archives from around that date. One of the best ways to speed up your code is to use Chart.js 2.8.0 and set |
… ticks
This causes a decrease in performance.