Performance: Partial templates
MEDIUM IMPACT
Partial templates affect page load speed by controlling how much HTML is rendered and reused, impacting server response time and browser rendering.
<%= render 'items', items: @items %> <!-- Render a single partial that loops internally --><%= render partial: 'item', collection: @items %>| Pattern | DOM Operations | Render Calls | Paint Cost | Verdict |
|---|---|---|---|---|
| Many small partial renders | N partial renders | N render calls | Higher paint delay due to slower HTML delivery | [X] Bad |
| Single partial with internal loop | 1 partial render | 1 render call | Faster paint due to quicker HTML delivery | [OK] Good |