What Your Selectors Are Doing When You’re Not Looking

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

At monday.com, engineers faced a large memory and runtime footprint caused by poorly behaved Redux selectors using Reselect v5's weakMapMemoization. Without visibility into selector behavior, they couldn't identify which selectors were causing problems. They built a monitoring layer by monkey-patching the memoization implementation, using WeakRef to avoid inflating reference counts, FinalizationRegistry to track GC activity, and batch processing offloaded during tab-hidden events. The result: per-selector metrics covering execution count, new result rate, GC collection rate, result size, and execution time. They defined selector behavior profiles (LLL, HHL, LHH, HHH) based on these metrics to classify and prioritize fixes. One HHH selector fix yielded 11% load time improvement, 15% freeze index reduction, 60% slice size reduction, and 7.5% memory savings.

8m read timeFrom engineering.monday.com
Post cover image
Table of contents
Do You Even Know What the Selectors are Doing?We Had to Start MeasuringThe Impact and Future PlansThe ImpactClosing

Sort: