- I optimized for compression by doing things the same way everywhere; e.g. I always put the class attribute first in my tags
- I wrote a utility that tried rearranging my CSS, in an attempt to find the ordering that was the most compressible
- I optimized for compression by doing things the same way everywhere; e.g. I always put the class attribute first in my tags
- I wrote a utility that tried rearranging my CSS, in an attempt to find the ordering that was the most compressible
Compression algorithms can do a better job when they're domain-aware. An HTML-aware algorithm could compress HTML much better than a general-use plain-text compression algorithm, without requiring the user to do things like put the class attribute first. Of course, that also requires the decompression algorithm to be similarly aware, which can be a problem if you're distributing the compressed bits widely.
Well not necessarily... An HTML-aware algorithm could for example rearrange attributes in the same order everywhere because it knows it doesn't matter.
Actually that would be a nice addition to the HTML "compressors" out there.
> Courgette transforms the input into an alternate form where binary diffing is more effective, does the differential compression in the transformed space, and inverts the transform to get the patched output in the original format. With careful choice of the alternate format we can get substantially smaller updates.
The reason for doing it wasn't so much the compression benefit but some of the nanoc code that generates the site did not always order the tags the same way and then it had to rsync up more than it needed to
http://code.google.com/p/closure-compiler/wiki/FAQ#Closure_C...
I've seen similar ideas in the demoscene 4k competition world, where code and music is arranged to have as many repeating self-similar patterns as possible so the executable compressors can shrink them optimally.
"Farbrausch" and their series of Fr-X "small" demos would be one example of this kind of "entropy trickery"
http://www.pouet.net/groups.php?which=322
The next target for crunching would be to minimize the actual amount of code given to the browser to execute, versus maximizing the compression ratio only (which is "just" correlated to the running "code" size)