premature optimization
Adding speed tricks before measuring that there is a real performance problem.
In more detail
Memoizing everything adds memory use, comparison work and stale-closure risk for often no gain. Profile first and optimise the hotspots you find.
Related terms
- memoization — Remembering the result of a calculation for given inputs and reusing it when the same inputs come again, instead of recalculating.
- Profiler — A React component, and a React DevTools tab, that measures how often and how long parts of the tree render.
- performance hotspot — The small part of a program where most of the time is spent, and where optimisation actually pays off.
Taught in
- Render Diagnostics: Profiling Re-Renders with React DevTools — React 19 & Modern Component Architecture
- React.memo, useMemo, And useCallback: Optimization Costs — React 19 & Modern Component Architecture