4. 规则
• YAHOO
– Best Practices for Speeding Up Your
Web Site
• Google
– Web Performance Best Practices
• 80/20
5. YSlow
Both
via @souders
use CSS sprites
combine scripts use a CDN
combine stylesheets configure ETags
add an Expires header use GET for Ajax requests
gzip responses reduce # of DOM elements
put stylesheets at the top no 404s
put scripts at the bottom avoid image filters
avoid CSS expressions optimize favicon
make JS and CSS external
reduce DNS lookups Page Speed
minify JS and CSS defer loading JS
avoid redirects remove unused CSS
remove duplicate scripts use efficient CSS selectors
make Ajax cacheable optimize images
reduce cookie size optimize order of CSS & JS
use cookie-free domains shard domains
don't scale images leverage proxy caching
19. initial payload and
execution Functions Executed before
JavaScript onload
www.aol.com 324 K 30%
www.ebay.com 234 K 34%
www.facebook.com 553 K 7%
www.google.com/search 21 K ??%
www.bing.com/search 10 K 35%
www.msn.com 152 K 55%
www.myspace.com 248 K 29%
en.wikipedia.org/wiki 99 K 19%
www.yahoo.com 381 K 33%
www.youtube.com 274 K 16%
229 K avg 29% avg
via @souders