I Timed Three Ways to Deduplicate an Array, Only One Scales
I benchmarked three ways to dedupe an array in Node 22, at sizes from 500 to 40,000 items A Set-based dedupe took 4.27ms at 40,000 items, filter plus indexOf took 1,229.68ms on the same input The gap is invisible under 2,000 items, then widens fast once one approach turns out to be O(n squared) One…
Read the full story at DEV Community — AI ↗
Timeline · 1 report
- 2026-11-17 00:58 · DEV Community — AI
I Timed Three Ways to Deduplicate an Array, Only One Scales