Performance: Page and action caching
HIGH IMPACT
Page and action caching mainly affect how fast the server can respond and how quickly the browser receives fully rendered content.
caches_page :show
def show
@post = Post.find(params[:id])
enddef show
@post = Post.find(params[:id])
render :show
end| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No caching, full render each request | High (new DOM each time) | Multiple reflows per request | High paint cost | [X] Bad |
| Page caching serving static HTML | Low (cached DOM reused) | Single reflow on load | Low paint cost | [OK] Good |
| Action caching with dynamic cache keys | Medium (cached per param) | Few reflows | Medium paint cost | [!] OK |