jk-gan / redux-flipper

Redux middleware for React Native for Flipper
MIT License
160 stars 21 forks source link

Slow when dealing with a big state tree #27

Closed lukemcgregor closed 4 years ago

lukemcgregor commented 4 years ago

I have a really large state tree (5mb + of JSON uncompressed). In the app itself its pretty quick to deal with and i dont have any performance issues but when i turn on redux-flipper, (also using flipper-plugin-redux-debug), the app is very slow and uses a lot of CPU.

As this is the app using CPU (not flipper) I think whatever the issue is exists in this library.

plwai commented 4 years ago

Did you enable any optional feature? It would be great if you can provide the createDebugger code segment.

lukemcgregor commented 4 years ago

Hey, thanks for the fast response. Ive tried two things:

if (__DEV__) {
  const createDebugger = require('redux-flipper').default;
  middleware.push(createDebugger());
}

and also with a blacklist on the biggest event I use.

if (__DEV__) {
  const createDebugger = require('redux-flipper').default;
  middleware.push(createDebugger({ actionsBlackList: ['BIG_ACTION']}));
}

It didnt seem to make any difference in speed between the two

From looking at your code, im guessing that the issue is with the Flipper.send code (inside the flipper library). Maybe its something to do with sending big payloads, as you have the whole state tree in there twice, which is probably cross process marshalled.

plwai commented 4 years ago

I have looked into the flipper library and got the same findings as well. The performance bottleneck is at the process of parsing JSON here. MIght need to open an issue in flipper side.

henrikra commented 4 years ago

@lukemcgregor Docs are wrong about actionsBlacklist https://github.com/jk-gan/redux-flipper/issues/32

ovidiu-balau commented 1 year ago

Is there any update on this? Even when only whitelisting a small part of the app, actions are still lagging behind real-time.