You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that this project is using standard gzip with level 9 compression in the scripts/dist.sh script. If Google's Zopfli compression algorithm were used instead, the minified gzip file could be made even smaller.
This can most easily be done with pigz, a drop-in multi-threaded replacement for gzip, which utilizes Zopfli when the compression level is set to 11.
I tested this against the latest 2.0.3 release of htmx.min.js:
gzip -9: 16,180 bytes
pigz -11: 15,694 bytes
This is a 3% reduction in file size. The resultant file is fully compatible with existing deflate/gzip -- decompression is unaffected.
Granted, this doesn't come entirely for free, at the expense of compute time:
root@server:~# time gzip -9 htmx.min.js
real 0m0.007s
user 0m0.003s
sys 0m0.004s
root@server:~# time pigz -11 htmx.min.js
real 0m0.146s
user 0m0.146s
sys 0m0.000s
Though I would argue the time difference is negligible and worth it, given the compress once, download many paradigm something like this project follows. Saving even just 486 bytes across the wire adds up with enough traffic.
I would definitely recommend reading this article which goes into more detail.
The text was updated successfully, but these errors were encountered:
I've noticed that this project is using standard gzip with level 9 compression in the
scripts/dist.sh
script. If Google's Zopfli compression algorithm were used instead, the minified gzip file could be made even smaller.This can most easily be done with pigz, a drop-in multi-threaded replacement for gzip, which utilizes Zopfli when the compression level is set to 11.
I tested this against the latest 2.0.3 release of
htmx.min.js
:This is a 3% reduction in file size. The resultant file is fully compatible with existing deflate/gzip -- decompression is unaffected.
Granted, this doesn't come entirely for free, at the expense of compute time:
Though I would argue the time difference is negligible and worth it, given the compress once, download many paradigm something like this project follows. Saving even just 486 bytes across the wire adds up with enough traffic.
I would definitely recommend reading this article which goes into more detail.
The text was updated successfully, but these errors were encountered: