You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a chart
Add a line series
Create a large dataset, a size of 1 million is good enough, filled with whitespace data (but the last to be able to scroll)
Add it to the line series via setData
Actual behavior:
While just doing this, sometimes it loads fully, sometimes it crashes. (every third reload in my case on an iPhone 13 Pro)
When there are more things going on, like in an actual app, it pretty much crashes the page constantly.
I suspect it's due to some allocation. Since it's mostly whitespace data, maybe there are things that could be optimized or avoided.
I tried to take a look at the code and test some things, while there are some inefficiencies like:
in data-layer.ts:180 which is not needed at all and can be replaced by a simple variable in the loop below, or things like pushing to an Array instead of creating with the right size and setting the value via an index, nothing seems to be good enough. A bigger change might be needed
The text was updated successfully, but these errors were encountered:
drgarlic
changed the title
setData might crash Safari iOS if dataset is too largesetData might crash Safari iOS if dataset is too large even if just whitespace
Jul 7, 2024
Lightweight Charts™ Version: Latest
Steps/code to reproduce:
Create a chart
Add a line series
Create a large dataset, a size of 1 million is good enough, filled with whitespace data (but the last to be able to scroll)
Add it to the line series via
setData
Actual behavior:
While just doing this, sometimes it loads fully, sometimes it crashes. (every third reload in my case on an iPhone 13 Pro)
When there are more things going on, like in an actual app, it pretty much crashes the page constantly.
I suspect it's due to some allocation. Since it's mostly whitespace data, maybe there are things that could be optimized or avoided.
I tried to take a look at the code and test some things, while there are some inefficiencies like:
in
data-layer.ts:180
which is not needed at all and can be replaced by a simple variable in the loop below, or things like pushing to an Array instead of creating with the right size and setting the value via an index, nothing seems to be good enough. A bigger change might be neededExpected behavior:
To not crash Safari iOS.
Screenshots:
CodeSandbox/JSFiddle/etc link: https://jsfiddle.net/t37n82w1/
The text was updated successfully, but these errors were encountered: