If you're taking this approach, why not just text/csv as your data format. If you already know the field order/names you can even omit the header row completely.
Well, at the end of the article he shows this technique used along with gzip. He however does not show a comparison of the original vs his 90deg compression with gzip; so the difference there may be negligible.
"After GZip the original file was squeezed down to just 132 bytes, however GZip took my technique down to just 99 bytes which saves a further 33 bytes."
While gzip compression is obviously better than this, which is more of an optimization, you can certainly pair this with gzip to get better results; albeit not much:
Sample JSON Object, using this technique:
>>> Length (Original): 25565
>>> Length (Original, gzip): 3966
>>> Length (Using 90deg): 15626
>>> Length (using 90deg, gzip): 3633
So while the optimization gives you almost 10k bytes in size reduction, the gzipped result is only a 300 byte reduction in this example.
12 comments
[ 4.3 ms ] story [ 43.0 ms ] threadWhen you want speed - every byte counts right?
Sample JSON Object, using this technique:
>>> Length (Original): 25565
>>> Length (Original, gzip): 3966
>>> Length (Using 90deg): 15626
>>> Length (using 90deg, gzip): 3633
So while the optimization gives you almost 10k bytes in size reduction, the gzipped result is only a 300 byte reduction in this example.
Changing your data structure for the sake of compression harms the main advantage of JSON: convenience.
http://malctheoracle.com/post/json-compression-part-deux