-
Notifications
You must be signed in to change notification settings - Fork 712
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
Graph layout optimizations #2128
Conversation
This is meant to help with #1188, right? |
4d6f757
to
8925c66
Compare
5bc21ed
to
7bbc6a8
Compare
@rade Yes, I finally explained the PR in the comment above. |
ouch! |
please file an issue to look for alternatives. |
Nice one! Small UI nits
|
7bbc6a8
to
3ae0b9d
Compare
Thanks for your comments @foot, here's my response:
|
Code looks really good tbh. Nice work! LGTM For another PR perhaps: I think it would be interesting to explore making the selectors "purer" in a sense, making them dependent only on on state (rather than props too), and that being the global state rather then local.
Would give quite a nice separation of cmp tree and selector/data/state tree. |
7b31b8c
to
c802c8c
Compare
@foot, about the changes you are suggesting to make selectors purer by using them only on the global state - my understanding is that that's precisely the way they were intended to be used, but I don't really understand why we should restrict this pattern to the global state only. In this particular case, it would work fine by moving some code up the hierarchy because we are using For the particular suggestions you made above, I think it's actually a very good idea and we could further benefit from it if we cached all the layout states globally, so that switching between them would never require layout recalculation. |
This PR aims at improving the performance of rendering graph layouts for a high number of nodes (see #1188). The changes made here are supposed to affect only performance, not in any way the layout being rendered - for discussion about alternative layouts, check out #1614 and the corresponding experimental branch #2119.
While a bunch of small optimizations have been applied successfully, I should stress out that the real bottleneck for dynamic layouts lays in https://github.com/cpettitt/dagre library, which we are using to get the nodes' coordinates for a nice layout. This is generally a difficult problem, but in case we'd want to stick with the current layout, we should consider alternatives to
dagre
for any further significant performance improvements, as this library is not maintained anymore.Some of the changes include:
prevent lagging effects.
nodes-chart.js
has been completely refactored by moving it to selectors (see https://github.com/reactjs/reselect).Suggestions for future optimizations:
NOTE: To test the contrast mode, I'll need to rebase with master again once #2165 gets fixed.