Course contentsShow
← React
Lesson 2301 of 2,39650. Performance: Optimization TechniquesFree lesson

When Virtualization Isn't Worth It

Recognizing when list sizes are small enough that virtualization overhead outweighs benefits.

When Virtualization Isn't Worth It

What you'll learn: How to recognize when the overhead of virtualization libraries outweighs their performance benefits for small lists.

The Overhead Tax

Virtualization libraries like React Window add complexity: extra components wrapping your list, scroll event listeners, position calculations, and dynamic rendering logic. For large lists (hundreds or thousands of items), this overhead is a tiny price for massive performance gains. But for small lists, you're paying the tax without getting the benefit.

The Tipping Point

As a rule of thumb:

  • Under ~50-100 items with simple content: Regular rendering is often faster
  • Simple DOM nodes (text, small images): The browser handles these efficiently
  • No scroll performance issues: If users aren't complaining and DevTools shows smooth rendering, you don't have a problem

The Hidden Costs

Virtualization introduces:

  • Bundle size increase (React Window is small, but still adds ~10-15KB)
  • Code complexity for your team to understand and maintain
  • Edge cases around scroll restoration, focus management, and keyboard navigation
  • Setup time calculating item sizes and container heights

When to Just Render Everything

Profile first! If your 30-item list renders in 15ms, adding virtualization might actually slow it down to 20ms due to the measurement and positioning overhead. The browser is remarkably good at rendering moderate amounts of simple DOM.

Think of virtualization like hiring a warehouse logistics system for your garage. If you only have 20 boxes, you're better off just stacking them yourself.

Key Takeaway: Virtualization is for solving actual performance problems with large lists—profile first, and don't optimize problems you don't have. Lists under 100 simple items rarely benefit from virtualization and may perform worse with it.