Jim said:
Of course it is 10 1000 byte files and 1 10000 byte file are the same
total size.
Will you please read more carefully? As I have already said, what you are
ignoring is that gzip compression is done per delivered resource, not per
connection. One 10000 byte (uncompressed) large resource can usually be
compressed better than 10 resources of a tenth of that size (uncompressed)
each because the large file contains more redundancy. That more redundancy
in the data allows for better compression of the data is a rule of thumb
about data compression.
I have also said that this fact (which worked in your *favor* -- did you
not recognize even that?) does not matter here because gzip-compressed
responses have no ultimate support on today's Web.
The drawback is that it is larger than the gzipped version, no matter how
many chunks there are.
What are you discussing, the question was do we have 10 1k files or 1
10k file, that's the topic at hand, [...]
And you have been arguing that because gzip compression exists, it does
not matter if it is one large file. Which is utterly wrong, as I have
pointed out. Do you have anything to say about this, or are you going
to do only another red herring?
2. Ideally each resource should be less than 1160 bytes, to easily fit
into one TCP/IP packet.
1160 bytes leaves you about 200 bytes for your js code, [...]
How did you get that idea? I said _"ideally"_.
Yes, but pretty irrelevant given the fact that so few scripts meet
your ideal.
What you are ignoring is that I did not say the total amount of data
downloaded for a document and included resources should be less then
1160 bytes. I was referring to the resource, and there are several
scripts out there that would meet this standard, including your some
of your own (e.g. your xmlhttp.js is 510 bytes large, _uncompressed_).
However, as I already pointed out, that was only an /ideal/ mentioned
as a hook for the actual argument that resources should be small.
I would never suggest sending anyone 100k script file, but I would
certainly recommend it to anyone suggesting they send 10 10k script
files.
But, as you are kindly keep reminding me, the question was: One file or
many? At first you were recommending one file, and I have pointed out
that since it is likely that one file will grow large, it is not viable,
despite the possibility of transparent gzip compression. Now you are
saying you recommend many files. ISTM you are not really clear with
yourself which position your are going to take, and to argument for or
against.
You seem confused by what the question was.
/You/ really seem confused by what the question was.
I certainly don't recommend libraries.
That is an entirely different question. I wonder what you regard as
a library, though. Every script file could qualify as a library.
Especially the type of script file you argued for before would.
Of course they are, if they're not, you should improve your build
techniques.
In this case they are not, because the design decision has direct impact
to what is delivered to the client. Certainly you are not recommending
to create a library (or a script file, if you wish), and then not use it
as is (compacting code, for example by removing documentation comments,
considered already), are you?
It has. Using one big library for everything is serving loads of
redundant code.
This was not a question about libraries, [...]
The question was whether one should use one (big) script file or
several (smaller) ones.
I still wonder what you would call a library, however that does not matter
regarding the question discussed. What matters is the size, hence I wrote
"one *big* library". I could have also wrote "one *big* script resource",
the argument would still the same, and still be valid.
ISTM you are being deliberately obtuse, and are misunderstanding me
deliberately, because you know that your gzip argument does not hold
water. Probably by acting this way you think you can make anyone
believe that you do not have to defend it against the arguments being
brought up.
PointedEars