Marc Frankel Marc Frankel - 1 month ago 5
CSS Question

Does JS/CSS minification help even if the files are cached?

I am well aware that a good practice in web development is to minify your JS and CSS files when you're done developing them to reduce the amount of data downloaded with each http fetch.

My question, however, is if JS and CSS file minification helps after the first page load if you're caching the files.

I have no doubt it helps the first time, but does minification also speed-up load and execution time if the file is being loaded from an on-disk cache?

Or at that point is its effect rather small. Please let me know your thoughts. Thanks.

Answer Source

Once the file is cached, it will not be downloaded again, unless the page specifies a different version of the file than is already present in the cache. As such, minification helps only when the file is downloaded and not thereafter.

The minification of the files certainly could (in theory) have an impact on parsing times of user agents, but given that we are only talking about characters, there would literally have to be tens of thousands of extraneous characters before any noticeable performance degradation would be seen. So, for practical purposes, a minified file won't be processed/parsed faster in any noticeable way than a non-minified one.