I read somewhere that organizing HTML attributes in a certain order can improve the rate of compression for the HTML document. (I think I read this from Google or Yahoo recommendation for faster sites). If I recall correctly, the recommendation was to put the most common attributes first (e.g. id
, etc.) then put the rest in alphabetical order.
I'm a bit confused by this. For example, if id
attributes were put right after every p
tag, the id
would contain unique values. Thus, the duplicated string would be limited to this: <p id="
(say there were <p id="1">
and <p id="2"/>
). Because the value of id
needs to be unique, I see this as actually causing an adverse effect to the compression.
Am I wrong?
If I needed to go through a static web page with randomly ordered attributes, what logic should I use to organize attributes to achieve maximum compression?
NOTE: I'm talking GZIP compression (if that matters): http://www.gzip.org/algorithm.txt