Lack of interest 30% File Size Improvement: Add gzip compression level in XenForo\Application::gzipContentIfSupported

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.
This suggestion has been closed. Votes are no longer accepted.
The current implementation makes a 30% larger CSS file
Code:
# curl -o css.php https://xenforo.com/community/css.php?css=xenforo,form,public&style=7&dir=LTR&d=1424957087
# cp css.php css.php-9
# gzip css.php -1
# gzip css.php-9 -9
# ls -lah | awk '{print $5, $9}'
16K css.php-9.gz
21K css.php.gz
 
This is a test with only three lines that shows the file size output for every gzip level available:
Code:
# curl -o css.php https://xenforo.com/community/css.php?css=xenforo,form,public&style=7&dir=LTR&d=1424957087
# for i in {1..9}; do cp css.php css.php-$i && gzip css.php-$i -$i; done
# ls -lah | awk '{print $5, $9}'
84K css.php
21K css.php-1.gz
19K css.php-2.gz
19K css.php-3.gz
17K css.php-4.gz
16K css.php-5.gz
16K css.php-6.gz
16K css.php-7.gz
16K css.php-8.gz
16K css.php-9.gz

Quick and dirty file edit to increase compression level to 5 when php takes over compression:
Code:
sed -i "s|\$content = gzencode(\$content, 1);|\$content = gzencode(\$content, 5);|" /path/library/XenForo/Application.php
 
Including the time it takes to compress:

Code:
# for i in {1..9}; do cp css.php css.php-$i && START=$(date +%s.%N) && gzip css.php-$i -$i && END=$(date +%s.%N) && DIFF=$(echo "$END - $START" | bc)  && mv css.php-$i.gz css.php-gzip_level:$i-seconds:$DIFF.gz ; done
# ls -lah | awk '{print $5, $9}'
84K css.php
21K css.php-gzip_level:1-seconds:.002500234.gz
19K css.php-gzip_level:2-seconds:.002505812.gz
19K css.php-gzip_level:3-seconds:.002744298.gz
17K css.php-gzip_level:4-seconds:.002758539.gz
16K css.php-gzip_level:5-seconds:.003160474.gz
16K css.php-gzip_level:6-seconds:.003726089.gz
16K css.php-gzip_level:7-seconds:.004091227.gz
16K css.php-gzip_level:8-seconds:.004373446.gz
16K css.php-gzip_level:9-seconds:.004191505.gz
 
Top Bottom