Performance: Active Record pattern
MEDIUM IMPACT
This pattern affects database query performance and page load speed by how it fetches and manipulates data in Rails applications.
posts = Post.includes(:user).all posts.each do |post| puts post.user.name end
posts = Post.all posts.each do |post| puts post.user.name end
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| N+1 queries without eager loading | Minimal DOM impact | No reflows caused by queries | Paint delayed by slow data fetch | [X] Bad |
| Eager loading with includes | Minimal DOM impact | No reflows caused by queries | Paint starts sooner due to faster data fetch | [OK] Good |