react-redux icon indicating copy to clipboard operation
react-redux copied to clipboard

Investigate hypothetical autotracking-based perf optimization

Open markerikson opened this issue 2 years ago • 2 comments

https://github.com/simonihmig/tracked-redux uses autotracking to selectively update UI components that depend on specific changed pieces of state.

I already ported that logic to Reselect, in https://github.com/reduxjs/reselect/pull/605 .

I wonder if there'd be some way to use this within React-Redux.

Like, what if we had an alternate Subscription implementation that wrapped store.getState() with this autotracking proxy and passed that around, then tracked which callbacks accessed the state and got smarter about when to re-run those?

I'm sure there's a ton of caveats here, such as nested subscriptions and connect, bundle size, perf overhead, etc.

related, yet another "Redux perf is hard at scale" talk: https://twitter.com/zeigenvector/status/1668713918049525760

markerikson avatar Jun 13 '23 23:06 markerikson

Just saw this issue now :) Please take a look at #2043 where I describe a potential way to use SolidJS's stores to avoid rerunning irrelevant selectors.

guillaumebrunerie avatar Jun 23 '23 23:06 guillaumebrunerie

There's some strongly-related work from the Causal team here, where they've built their own store subscriptions and are trying to narrow down how many selectors run based on ordering:

  • https://twitter.com/lukaskoebis/status/1721535684748464494
  • https://www.causal.app/blog/re-re-reselect

markerikson avatar Nov 06 '23 23:11 markerikson