I have a large array of JSON objects I’m storing in a single Redux variable (~8k items, each with object about 1kb each for a total of 8mb). This seems to make Redux calls slow even for the most trivial actions and reducers that don’t actually do anything. For example, calling this doNothing() action and reducer produces a 500ms wait time on device without running on the debugger:
// action
export const doNothing = () => {
return {
type: DO_NOTHING
};
};
// reducer
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case DO_NOTHING: {
return state;
}
default:
return state;
}
};
My best attempt to profile this issue is via slowlog, which is where I came up with the 500ms figure for the Redux call in my React component. For a smaller set of data (~500 items), I still get a wait, but it’s closer to 100ms. This is all on device and it gets slower on the simulator and the debugger. I'm testing this on a simple view with just a button to rule out complications from expensive re-selects and re-renders. A possible complication is that I'm using redux-offline which persists the Redux store to AsyncStorage, however I get identically poor performance when I turn off persistence.
Ideally I address the bottleneck directly, but I’m also open to workarounds. I tried wrapping the action calls in setTimeout, but that just seems to delay the slowdown in my React Native app.
Thanks in advance for any suggestions!