Performance: Email previews
MEDIUM IMPACT
Email previews affect server response time and initial page load speed when rendering email content in the browser.
def show @email = Email.find(params[:id]) @preview = truncate(strip_tags(@email.full_html_body), length: 300) render html: @preview.html_safe end
def show
@email = Email.find(params[:id])
render html: @email.full_html_body.html_safe
end| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full raw email HTML rendering | High (many nodes) | Multiple reflows | High paint cost | [X] Bad |
| Sanitized truncated preview | Low (few nodes) | Single reflow | Low paint cost | [OK] Good |