Given just page speed, at what point are CSS or JS big enough to externalize

A general tip is to keep your CSS and JS files external. Reason: what you lose in the extra HTTP request * you often get back without loading cached static content (which is usually CSS and JS).

However, the smaller your external file, the more penalties for an additional HTTP request - even if it is a 304 Not Modified response. Thus, the smaller the external file, the more reasons to support embedding CSS and JS content, at least when speed is your primary concern.

I did some tests. Without details, my results look like this:

External File Size    Average Gain
----------------------------------
               1KB          -3.7ms
               2KB          -3.7ms
               4KB          -4.0ms
               8KB          -3.0ms
              16KB          -2.7ms
              32KB           1.0ms
              64KB           2.7ms
             128KB          10.0ms
             256KB         493.7ms
             512KB        1047.0ms
            1024KB        2569.7ms

, , . , 50-100 ... gzipped, .

?

(* , HTTP Expires)

+5
1

, , . , - gzip , , ( , ) , , .

, , , 5 / 100 . , 62 500 , . .

, " ", / . , , CSS JavaScript, . , , , / . .

+2

All Articles