Max Size Minify / Combining JS Files

I am wondering what is the maximum Minify / Combining size of a single file. Therefore, I have several js files, and I believe that I need to make about 2-3 servings of files for 3-5 files.

+4
source share
2 answers

There is no hard and fast golden rule. Typically, you want to make the page load with as few HTTP requests as possible. However, Ultimate's goal is to make the page load as fast as possible. While reducing the number of queries is key, this is not the only factor. For example, if you have a page with one 100k js file, no css, no images, no other requests. This page will load faster in most modern browsers if 4 25 thousand Js were requested on the page because 4 requests can be parallelized over 4 connections. However, your typical web page has from 30 to 100 requests, and they will load much faster, combining files, since most browsers are limited to 6 connections per host, and there is latency when opening new connections, as well as problems with blocking with javascript and css depending on where no other connections will be started until js or css is loaded. It may also depend on whether these resources are in the head or not.

Thus, it all depends on your page and the target browsers. Personally, I use 50k as the maximum size for a single css or js. This, admittedly, is not extremely scientific. Its a nice round number and the one I find holds a few typical css or js files and is not so large that it is exorbitant.

+6
source

Maximum Size - Maximum Largest Request

uh

index 3KB CSS 10KB jquery 32Kb 

The best size is around ~ 14KB = MTU + headers

uh

 CSS 16Kb - 172ms JS 32Kb - 359ms Js 17KB - 281ms JS 15,8KB - 250ms ga.js 13KB - 109ms 

Apache does not compress deflate file greeter that 3MB

Conclusion If you have 1 JS file about 32Kb

 * Download this file: ~359ms 

If you have 2 JS files for 15Kb

 * Download this 2 file: ~259ms 
+3
source

Source: https://habr.com/ru/post/1393548/


All Articles