| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Can you update the PR description to explain the high-level idea / organization of this PR? (e.g. what parse in scale vs controller are each used for). And also why each of the changed tests are different?
Should this replace all usage of getRightValue (if not in this PR then eventually)? I think there's still about half a dozen left
Are there any performance impacts (positive or negative) on large charts? e.g. I wonder how it would affect the uPlot benchmarks
Sorry, something went wrong.
| delete array._chartjs; | ||
| } | ||
|
|
||
| function storeCrossRef(scale, datasetIndex, scaleValue, datasetValue) { |
There was a problem hiding this comment.
Can you add a comment explaining what the cross-ref is?
Sorry, something went wrong.
|
I just took a cursory glance at this PR in the Chrome debugger. I see _parse being called a bunch of times from addElements within initialize. And then a bunch from resyncElements within buildOrUpdateElements. I didn't look into it, but I wouldn't think we'd need to do it twice in a row This PR seems about 10% slower overall on the uPlot benchmark, but it seems like that should be addressable |
Sorry, something went wrong.
|
This PR goes way too far now, but I wanted to see where it could go. There are some things that can be extracted to separate PR's. Speed: first update is somewhat similar to current master (from chartjs.org - it does not seem to include all commit). So in reality its slower. Subsequent updates are a lot faster. Try hiding / showing datasets in those two; |
Sorry, something went wrong.
|
Some benchmarks done in my laptop, using uPlot benchmark + plugin to measure between events: master (3cb308d) chart.update()master So, first update is about the same and subsequent updates are faster (~30%). Same chart, draw + 50x update(). master takes 29..30 seconds. Early parse 18..19 seconds. More than 30% faster. The speed improvement comes from caching the parsed data, and can surely be done without "early parsing" too. |
Sorry, something went wrong.
There was a problem hiding this comment.
It seems like it should be possible to store the data internally as {x: 0, y: 1} instead of {index: 1, xScale0: 0, yScale0: 1}. Then in the base _parseObjectData case we wouldn't actually have to do any parsing at all, which should be a speedup (though maybe behind a skipParsing flag for 2.x, which says you've passed in only numbers)
Sorry, something went wrong.
|
In 3.0 I'd really like to see us get rid of parsing altogether. It really slows things down. We could perhaps provide some data transformer utilities to help users get their data into the format we expect if we want to support multiple formats. @etimberg was asking about making the next version 3.0 (#6555 (comment)). Perhaps we should think about how we'd approach this if we didn't have to worry about backwards compatibility |
Sorry, something went wrong.
|
A couple thoughts about how we might approach this:
|
Sorry, something went wrong.
|
@benmccann from a performance point of view, you are correct. That approach however does not solve the issues I'm trying to solve here. Removing parsing would make this lib a bit harder to use in many cases - and IMO ease of use is one of the things making this lib so popular. |
Sorry, something went wrong.
|
We might be able to make parsing optional though. If you want to pass in data in our ideal format then we would not need to do parsing and if you want to be loose with the data then we'll massage it for you I think the main thing you'd need to do is change it back so that it stores data as {x: 0, y: 1} instead of {xScale0: 0, yScale0: 1} |
Sorry, something went wrong.
It helps avoiding isHorizontal() / getRightValue() calls by storing that way. We could default the axis id:s to 'x' and 'y' though. |
Sorry, something went wrong.
|
Another thing I was thinking is that I don't think the scales really need to be aware of parsing at all and we might be able to keep it all in the controllers. E.g. the linear and logarithmic scales right now need to know about floating bar charts in order to determineDataLimits. However, if we move determineDataLimits to the controller then I think things become a lot cleaner because we can contain all the parsing purely in the controllers. Then bar chart is the only one that needs to know about floating bars and we can keep the logic contained in a much smaller area
We still call _getParsedValue, which is essentially the new getRightValue, so I don't think it'd make much different on that one. You would need to call isHorizontal, but I think it would end up being a lot faster because you would really only need to do that once per dataset, which would be a lot cheaper than having to construct a new dataset if the user passes in data in the desired format |
Sorry, something went wrong.
|
I refactored linkScales a bit too (CC was complaining about it). The tests done were more expensive than the assignment (and linkScales is not critical anyway), so changed it to always assign. And extraced getFirstScaleId (should be easier to change for #6626) |
Sorry, something went wrong.
There was a problem hiding this comment.
Great initiative! Thanks so much for driving this!
I really like it overall. I think there are a couple more things we might be able to do based off of this or a couple things I would tweak, but I'd rather do those in follow up PRs to be able to get this in and build off it
Sorry, something went wrong.
|
Benchmarks with latest version: {
"2 update/total": 620.79,
"3 render/total": 177.54,
"x from page load": 802.21
}2nd update: {
"2 update/total": 284.52,
"3 render/total": 124.38
}50x update: ~17s master {
"2 update/total": 703.42,
"3 render/total": 143.66,
"x from page load": 850.76
}2nd update: {
"2 update/total": 521.75,
"3 render/total": 127.67
}
Code
}50x update: ~27s |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
#6106 done a bit further.
Leading thoughts
dataset controllers
Data formats
Pen
Pen - far far away
Pen - master
Fixes: #6103
Fixes: #5657
Fixes: #5405
Fixes: #5072
Fixes: #6437
Fixes: #6455
Closes: #6136
Closes: #6461
(probably some more)