170 likes | 258 Views
High Performance Web Sites Essential Knowledge for Frontend Engineers. Steve Souders souders@google.com http://stevesouders.com/. Disclaimer: This content does not necessarily reflect the opinions of my employer. The Importance of Frontend Performance. 9%. 91%. 17%. 83%.
E N D
High Performance Web SitesEssential Knowledge for Frontend Engineers Steve Souders souders@google.com http://stevesouders.com/ Disclaimer: This content does not necessarily reflect the opinions of my employer.
The Importance of Frontend Performance 9% 91% 17% 83% iGoogle, primed cache iGoogle, empty cache
The Performance Golden Rule 80-90% of the end-user response time is spent on the frontend. Start there. greater potential for improvement simpler proven to work
14 Rules • Make fewer HTTP requests • Use a CDN • Add an Expires header • Gzip components • Put stylesheets at the top • Put scripts at the bottom • Avoid CSS expressions • Make JS and CSS external • Reduce DNS lookups • Minify JS • Avoid redirects • Remove duplicate scripts • Configure ETags • Make AJAX cacheable
YSlow High Performance Web Sites
http://conferences.oreilly.com/velocity/20% discount: vel08st
Rule 1: Make fewer HTTP requests CSS sprites combined scripts, combined stylesheets image maps inline images
CSS Sprites size of combined image is less <span style=" background-image: url('sprites.gif'); background-position: -260px -90px;"> </span>
Rule 3: Add an Expires header not just for images
Rule 5: Put stylesheets at the top stylesheets block rendering in IE solution: put stylesheets in HEAD (per spec) avoids Flash of Unstyled Content use LINK (not @import)
Rule 6: Move scripts to the bottom scripts block parallel downloads across all hostnames scripts block rendering of everything below them in the page move scripts as low in the page as possible
Even Faster Web Sites • Split the initial payload • Load scripts without blocking • Don't scatter scripts • Split dominant content domains • Make static content cookie-free • Reduce cookie weight • Minify CSS • Optimize images • Use iframes sparingly • To www or not to www
Why focus on JavaScript? Yahoo! Wikipedia eBay AOL MySpace YouTube Facebook
Takeaways focus on the frontend run YSlow: http://developer.yahoo.com/yslow Velocity: http://conferences.oreilly.com/velocity/ speed matters you CAN make your site even faster!
Steve Souders souders@google.com http://stevesouders.com/