At high serial speeds, not sure it'll matter much. I looked at a random 2mb file:
- total characters in file: 2040048
- spaces in file: 203681
So that's about a 10% ratio. Going with 10 bits per byte for serial (start/data/stop bits):
- time to transmit ALL characters at 9600 baud: 2125 sec (35 mins)
- time to transmit ALL characters at 38400 baud: 531 sec (9 mins)
- time to transmit ALL characters at 115200 baud: 177 sec (3 mins)
So, what if you could transmit in 480 seconds instead of 530 seconds? Sure, that's a minute of savings, but that's across a couple hours of print time. How much time on an individual command? My longest line is 886 characters, that's under one second even at 9600 baud, it might save 1/10th of a second sending a command.
FWIW, basic gzip compression reduces by 80%, bzip reduces by 86%, zpaq
-m5 by 91%, cmix (without preprocessing) by 94%.
cmix was killing my dev machine, so I stuck it on a 16-cpu 64gb ram server. It took 56 minutes.
For fun, acknowledging the Mythbusters "if it's worth doing, it's worth overdoing" rule, I tried on a bare-metal server, 72 cpu/512 gb ram. It still took 50.5 minutes.
For the lulz I should try cmix on a pi3 and a pi zero.
Interesting math exercise though.