nteract / semiotic

A data visualization framework combining React & D3
https://semioticv1.nteract.io/
Other
2.43k stars 132 forks source link

Expect immutable data in XYFrame #653

Closed alexeyraspopov closed 1 year ago

alexeyraspopov commented 1 year ago

Derive function for XYFrame attempted to check if any input data has changed before recalculating the frame state. The way how basicDataChangeCheck() is implemented, it implies that even if the data hasn't change by reference, it may have changes in the internal value it holds. Basically, we check for mutable changes in data arrays (e.g. use of [].splice()). The way how the further mutable changes check works is N^2 checks for N being the size of array. It appears that the part works very slow in Safari, up to the point where redundant re-render is cheaper than the memoization check preventing it.

Given the nature of Semiotic being a React library, it is hard to come up with scenario where a re-render of XYFrame can be triggered after mutable changes of data. It has to be very intentional and hacky thing. In this PR I suggest we avoid complex changes checks and embrace the requirement to use immutable data.

@emeeks, is there any other places like this that we can improve by dropping exhaustive changes checking?

I ended up removing whole src/components/processing/diffing.ts file since no other functions had any use.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
semiotic ✅ Ready (Inspect) Visit Preview Jan 17, 2023 at 8:31PM (UTC)