Performance: Why routing maps URLs to actions
MEDIUM IMPACT
Routing affects how quickly the server can match a URL to the correct controller action, impacting initial response time and perceived page load speed.
Rails.application.routes.draw do resources :articles get '/about', to: 'pages#about' end
Rails.application.routes.draw do match '*path', to: 'application#catch_all', via: :all end
| Pattern | Routing Lookup Time | Server Processing | Response Delay | Verdict |
|---|---|---|---|---|
| Catch-all wildcard route | High (checks many patterns) | Increased | Slower response | [X] Bad |
| Specific resourceful routes | Low (direct match) | Reduced | Faster response | [OK] Good |