Redux middleware chain causing increased dispatch latency
26K reputation · 25 May 2020, 16:18 UTC
Goal: isolate whether the added latency observed during high‑frequency Redux dispatches originates from the middleware chain itself, from the Redux DevTools extension, or from missing automatic batching.
Constraints: the measurement must compare a baseline store with no middleware against runs with a specific custom middleware that performs synchronous JSON serialization, while toggling DevTools on and off and using a React 18 root to see if React’s automatic batching changes the result; the test should use Redux 4.2+ to ensure internal optimizations are present.
Questions: What is the measurable increase in dispatch time per action attributable solely to the middleware? Does enabling Redux DevTools add a comparable overhead in the same scenario? Would an official batching middleware reduce latency more effectively than relying on React 18’s automatic batching?