Steve Souders
stevesouders.com · Personal blog · on HN since 2008
Steve Souders writes about web performance, covering page load speed, CSS selectors, caching and browser quirks, and is author of High Performance Web Sites.
What HN saysHN commenters call it the best resource for web performance tips and cite his data on CDN caching when debating shared library caches.
157HN people shared it
79linked it in comments
127stories submitted
1.0Kstory points
2 months agolast shared
2008people per year2026
Most-shared posts
- 1HTTP Archive: jQuery16 people · 4 points · first shared 2013 · discussion on HN
- 2IE7 & IE8 will download stylesheets twice if the url scheme is missing7 people · 2 points · first shared 2010 · discussion on HN
- 3The Performance Golden Rule6 people · 19 points · first shared 2012 · discussion on HN
- 4Simplifying CSS Selectors6 people · 4 points · first shared 2010 · discussion on HN
- 5Performance Impact of CSS Selectors5 people · 24 points · first shared 2009 · discussion on HN
- 6Steve Souders - High Performance Web Sites5 people · 1 points · first shared 2009 · discussion on HN
- 7Don’t use @import4 people · 79 points · first shared 2009 · 14 comments on HN
- 8Rules for Faster-Loading Web Sites4 people · 6 points · first shared 2009 · discussion on HN
- 9High Performance Web Sites: Crockford, webhosting, online dating, JSON, alert3 people · 71 points · first shared 2009 · 15 comments on HN
- 10JavaScript Performance3 people · 5 points · first shared 2012 · discussion on HN
- 11Cuzillion3 people · 5 points · first shared 2008 · 2 comments on HN
- 12Loading Scripts Without Blocking3 people · 4 points · first shared 2009 · discussion on HN
- 13Frontend SPOF3 people · 3 points · first shared 2010 · discussion on HN
- 14Mobile Performance Testing3 people · 2 points · first shared 2011 · discussion on HN
- 15Frontend SPOF in Beijing3 people · 1 points · first shared 2012 · discussion on HN
What HN people wrote when they linked it
huskyr · 2012-04-26
Nice overview, for even more tips on performance the best resource is Steve Souders' blog:
http://stevesouders.com/
isleyaardvark · 2011-01-27
It's the opposite, I recommend you check out the work of Steve Souders, his blog and his books (http://stevesouders.com/). The general idea is that the server is going to be speedier (through a combination of hardware than caching) than the user's machine. And there are a lot of old machines out there.
Souders estimates that around 80-90% of a site's slowness has to do with the time it takes for the browser renders the page, js slows that down.
jacobr · 2016-06-30
This is nice in theory, but... A user visits site A. To get a cached version of React the following need to be true:
1. A user has to have visited a site, site B, with React recently.
2. The site with React needs to be using a publicly available CDN.
3. Site A and Site B must use the same CDN.
4. The versions of React must match exactly. There are already about a dozen alpha/patch/rc versions of the React 15.x.x series alone.
In practice, this does not happen very often: https://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
strommen · 2014-11-03
Really, the first concrete piece of advice is to strip whitespace and comments from HTML? That's like trying to save gas in your car by emptying out the glove compartment.
There are some good nuggets in here though - the image/table size is a good one, and it drives me crazy when pages thrash their layout as images load.
But if you want to make your site faster, start with http://stevesouders.com/hpws/rules.php. (Some of those techniques may become obsolete with HTTP/2, but that's a ways off yet from being widespread enough to matter too much).
Isofarro · 2014-06-30
"The article misses the main point of content delivery network JavaScript: The hot cache."
The stats don't really bear that out:
http://statichtml.com/2011/google-ajax-libraries-caching.html
and a followup two years later:
http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
these third party CDNs are littered with different versions of jQuery and whatever, so the fragmentation of top sites using different versions seems to dent the chances of having one of these libraries hot cached.
Duhck · 2013-07-15
You should avoid including script tags in the head because it introduces single points of failure in your app. Losing a few ms of 'analytics' time is better than providing your users with a broken site because your analytics scripts (or any other hosted JS files) didn't load and waited 5-15s to timeout (depends on browser).
Steve Souders gives a great talk on this: http://www.stevesouders.com/blog/2010/06/01/frontend-spof/
acdha · 2013-04-09
But only for uncached resources - see Eric Lawrence's comment:
“Internal to Trident, the download queue has “de-duplication” logic to help ensure that we don’t download a single resource multiple times in parallel.
Until recently, that logic had a bug for certain resources (like CSS) wherein the schema-less URI would not be matched to the schema-specified URI and hence you’d end up with two parallel requests.”
http://www.stevesouders.com/blog/2010/02/10/5a-missing-schema-double-d…
You could use a resource loader if you really cared but with IE8 under 10% and dropping I'd recommend keeping your site clean and maintainable – anyone using IE8 at this point is used to the web being slow and ugly so something like this will be the least of their worries.
no_more_death · 2013-03-19
Step 1: Learn to use the CSS profiler in Chrome.
Also, here are some articles I found in my links list:
CSS Stress Tester Bookmarklet (Copy into a bookmarklet. Then it will tell you the rules that are causing the most lag.)
javascript:(function(d){var s=d.createElement('script');s.src='http://andy.edinborough.org/Demos/css-stress/stressTest.js?_=+Math.ran… es=d.getElementsByTagName('script')[0];es.parentNode.insertBefore(s,es);var doit=function(){if(window.stressTest){stressTest.bookmarklet();}else{setTimeout(doit,100);}};doit();})(document);
Old but still relevant I think: http://www.stevesouders.com/blog/2009/06/18/simplifying-css-selectors/
Text makes CSS slow (don't render too much): https://news.ycombinator.com/item?id=2232212
In general, following good guidelines might help: https://github.com/csswizardry/CSS-Guidelines
cantlin · 2013-01-15
My understanding is that performance is a negligible factor next to maintainability when writing CSS in virtually all cases. The best post I've seen on the subject is by Steve Souders[0], which does include some numbers.
[0] http://www.stevesouders.com/blog/2009/03/10/performance-impact-of-css-…
Further reading:
http://csswizardry.com/2011/09/writing-efficient-css-selectors/
https://developer.mozilla.org/en-US/docs/CSS/Writing_Efficient_CSS
thisisblurry · 2012-10-24
If you don't want to use Zoompf (even if they don't follow their own advice), you should take a look at Steve Souders' blog for web performance: http://www.stevesouders.com/blog/
He literally wrote the book on it.
j79 · 2012-06-01
I was lucky enough to listen to Souders talk at Fluent this past week. He talked about Front-end SPOFs and specifically an experience in Beijing where Business Insider didn't load because of a third party widget (Twitter, in his case) being blocked.
One site he mentioned (and great for testing) was webpagetest.org.
Here are the slides from the talk: http://stevesouders.com/talks.php
He blogged about the issue here:
http://www.stevesouders.com/blog/2012/03/28/frontend-spof-in-beijing/
tkaemming · 2011-07-22
Also worth noting is Steve Souders' control.js (http://stevesouders.com/controljs/) which adds some tools for delayed script execution and solves a few document.write use cases that have been issues with deferred loading/execution.
jlgosse · 2011-02-10
If you think something doesn't look correct, it might be a good idea to try again:
http://www.stevesouders.com/blog/2011/02/10/blaze-io-launches-wpt-with…
Souders himself recommends that if things don't work well for you right now, you should try again a few times. If things still don't work, it may be a good idea to come back in a few days.
jbox · 2010-03-09
Steve's final conclusion:
“For most web sites, the possible performance gains from optimizing CSS selectors will be small, and are not worth the costs. ”
http://www.stevesouders.com/blog/2009/03/10/performance-impact-of-css-…
mscarborough · 2009-04-14
These points have also been covered at length by Steve Souders (formerly of yahoo, currently at google - http://stevesouders.com/), the YSlow Firefox add-on, and the Yahoo Exceptional performance team itself (http://developer.yahoo.com/performance/).
TammyEverts · 2024-03-04
I've been working in the performance industry (focusing on front-end performance and UX) for 15 years. Some resources you might find helpful:
• Steve Souders' books 'High Performance Web Sites' & 'Even Faster Web Sites' – https://stevesouders.com/ – Steve literally wrote the book(s) on performance and is widely considered the godfather of the industry.
• WPO stats – https://wpostats.com/ – Case studies and experiments demonstrating the impact of performance optimization on UX and business metrics
• performance.now() talks – https://www.youtube.com/c/WebConferencesAmsterdam/videos – PerfNow is the only annual global conference dedicated to performance. You can watch past talks on their YouTube channel.
• Intro to Web Performance – https://support.speedcurve.com/docs/psychology-of-web-performance – This is a collection of introductory articles covering topics like the psychology of sit speed to Core Web Vitals to how to create a performance culture in your organization.
chubot · 2017-12-31
As far as Google goes, the easiest place to get better end-user latency/performance (2x-3x) is ... fixing the JavaScript.
I'm being totally serious. Backends are generally fast, and the backend engineers are performance-minded.
Front end engineers are not as cognizant of performance (somewhat necessarily, since arguably they have a harder problem to solve). Back in the mid-2000's, Gmail/Maps/Reader days Google had a lot of great JS talent, but it seems to have ceded some of that ground to Facebook and Microsoft.
If you have heard Steve Souders speak, he always mentions that he was a backend guy. Until he actually measured latency, and realized that the bottleneck is the front end. That was at Yahoo, but it's very much true for Google too.
http://stevesouders.com/bio.php
I would like to see a machine learning system rewrite JavaScript code to perform better and make UI more usable. I believe that's beyond the state of the art now, but it's probably not out of the question in the near future.
-----
As far as scheduling that was just one example of an important systems problem that hasn't been solved with machine learning. Not saying it can't be, of course. Just that this is a research direction and not a deployed system.
It's also important to note that there are plenty of other feedback-based/data-driven algorithms for resource management that are not neural nets. If neural nets work, then some simpler technique probably works too.
paulsutter · 2014-12-18
Separate domains for CSS and images files are primarily intended to overcome certain (old?) browsers' limitation on the number of concurrent connections to a single domain [1][2]. Cookieless domains can only help you if you have supermassive cookies. Keep those to a special subdomain, if you really need to have them. But you probably don't.
There is no one rule of thumb for performance. Generally, inline everything that's small enough to inline. If it's big enough such that caching a separate file will help you on subsequent page loads, then put it in a separate file.
Test and measure. If you can't measure the difference, it doesn't matter. If you don't measure the difference, the rule you are following probably isn't helping you.
[1] http://www.stevesouders.com/blog/2013/09/05/domain-sharding-revisited/
[2] http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connec…
spjwebster · 2014-03-10
I did some research on this a few years ago [1], and Steve Souders recently re-ran the test with the latest http archive data [2]. Given the percentages, I'm still not convinced that it makes sense to reference jQuery or any other library from a shared CDN.
That said, you also need to be careful with concatenation. It's tempting to go for a 'concatenate everything into one file' approach, but that can be suboptimal. When you've got a large library like jQuery that changes infrequently, concatenating that with your constantly-evolving application code results in your users paying the download cost for jQuery every time you make a change (albeit without the connection overhead). Instead, it make sense for some applications to bundle third party libraries into one file, and the application code into another.
As I said in my original article, the most important thing you can do to improve the performance of your site is to measure client-side performance from your real user traffic, establish a baseline and only then try various techniques and see which ones have the greatest impact for your site and your visitors. There are various techniques that /might/ help, and some are more universal than others, but you won't know for sure if a change helped or hindered if you can't look at your stats.
[1] http://statichtml.com/2011/google-ajax-libraries-caching.html
[2] http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
pierrefar · 2009-12-14
I got the headers by right-clicking on some image links and seeing what I got. Can't reproduce it right now. Apologies if there was a brain freeze moment.
I've been thinking about how to best do this over the weekend and the approach I cam up with is this: Use Cloudfront (Amazon's CDN) and use custom CNAMES for S3 buckets. An S3 bucket would be an image library (say tango.stdicon.com) and so the subdirectories of this Cloudfront subdomain would be the images sizes (tango.stdicon.com/48/foo).
This sets up a nice CDN with proper headers and a scalable way to add more libraries (just add subdomains).
This also has the "very advanced use-case" advantage: website owners can CNAME to the same library subdomain multiple times (say assets1.mysite.com assets2.mysite.com and assets3.mysite.com) and let the browser download images in parallel. See these two refs:
1. http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connec…
2. http://www.websiteoptimization.com/speed/tweak/parallel/
Would love to talk more if you're interested. Email address "encoded" in my profile page.
lelandfe · 2026-08-21
A nice technique to learn of this situation is to fail ("black hole") random resources in synthetic loads of the frontend. This lets you find out 'bout these single points of failure, and then you can start adding fallbacks.
This is a pretty ancient thing as far as the FE goes: https://www.stevesouders.com/blog/2010/06/01/frontend-spof/
runamok · 2021-11-23
I mean CDNs (content delivery networks) are pretty much agreed help performance by serving static content close to the end user. https://stevesouders.com/examples/rules.php
And you'd be surprised how much bot traffic that most sites get that you may or may not want to allow. Not every user feels comfortable setting up Let's Encrypt (though I agree it's awesome) or even has sufficient privileges to do so.
Compared to other services like AWS Cloudfront/WAF/etc., Fastly, Akamai, etc. IMO their offerings are quite powerful and economical.
https://www.cloudflare.com/plans/#overview
flowerlad · 2020-12-18
This code is very inefficient:
.autobot > * {
margin: auto;
}
Browsers match CSS selectors right-to-left. Because there is a * at the end, this rule has to be matched against every element.
More info:
https://stackoverflow.com/questions/5797014/why-do-browsers-match-css-…
https://www.stevesouders.com/blog/2009/06/18/simplifying-css-selectors…
imron · 2016-10-20
You can, but that can cause issues with browser caching (http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use… and in any case I prefer the cleaner urls :-)
Plus, once it's configured you never have to worry about it again.
michaelmior · 2016-05-21
Because async doesn't do what you think it does.
https://www.stevesouders.com/blog/2012/01/13/javascript-performance/#c…
hyperpape · 2016-04-02
The caching is surprisingly bad: http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
Facebook did a related study more recently and found that large numbers of users had cold caches (https://code.facebook.com/posts/964122680272229/web-performance-cache-…
mutagen · 2014-12-27
I suspect the caching benefit is minimal, the vast majority of visitors won't have the fonts in cache. I'm basing my suspicion off the research done into jQuery cache hit success rates at http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
Web performance is complicated though and all the pros and cons interact in non-intuitive ways. A comparison of self-hosted, inexpensive CDN hosted, and original Google hosted may provide some performance surprises.
lolwhat · 2014-12-17
most of the time, it's less than 1% http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
LocalPCGuy · 2014-12-17
Not really, the cache-hit benefit is a myth. Too many CDNs, too many versions of jQuery in use, cache's too small...
So ..using jQuery via a CDN, depending on which you use you have a 1 in 119, or 1 in 833 chance of the user having a cached copy.
http://www.i-technology.net/2013/11/the-myth-of-cdn.html
more data: http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/
There are valid reasons to use a CDN (get the scripts closer to the end user, offload the data transfer costs to the CDN provider, etc) but it isn't due to the potential for a cache hit.
hobohacker · 2014-01-08
To your points about pipelining, there's a reason it doesn't get compared. It's not usable - https://insouciant.org/tech/status-of-http-pipelining-in-chromium/
Head of line blocking is so well documented that there are many common web performance techniques to get around it, like domain sharding: http://www.stevesouders.com/blog/2009/05/12/sharding-dominant-domains/… It'd be very interesting to see where you get your data that head of line blocking is not a problem.
I'm not sure where you are getting your info that SPDY was designed largely by one recent college grad. I don't think of Mike Belshe and Roberto Peon as the same person, much less recent college grads :) Maybe 40+ year olds still counts as "recent"?