Performance: MVC architecture in Rails
MEDIUM IMPACT
MVC architecture in Rails affects how quickly the server can respond and how efficiently the browser renders the page by organizing code and data flow.
class UsersController < ApplicationController def index @users = User.select(:id, :name).limit(50) render :index end end
class UsersController < ApplicationController def index @users = User.all @posts = Post.all render :index end end
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Loading all data in controller | N/A (server-side) | N/A | N/A | [X] Bad |
| Selective data loading with limits | N/A (server-side) | N/A | N/A | [OK] Good |