Skip to content

Instantly share code, notes, and snippets.

@CezaryDanielNowak
Created November 21, 2024 09:49
Show Gist options
  • Save CezaryDanielNowak/b6a1c811a32031e58dda6614059453d8 to your computer and use it in GitHub Desktop.
Save CezaryDanielNowak/b6a1c811a32031e58dda6614059453d8 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd sdk-js/dist/
find . -name "*.br" -type f -delete
find . -name "*.gz" -type f -delete
for i in {0..11}
do
echo "[ BROTLI ${i} ]"
time {
find -name '*.html' -exec brotli -q $i -f -n -o "{}.br" "{}" \;
find -name '*.js' -exec brotli -q $i -f -n -o "{}.br" "{}" \;
find -name '*.css' -exec brotli -q $i -f -n -o "{}.br" "{}" \;
find -name '*.wasm' -exec brotli -q $i -f -n -o "{}.br" "{}" \;
find -name '*.json' -exec brotli -q $i -f -n -o "{}.br" "{}" \;
}
find . -name '*.br' -exec stat -c %n,%s {} \; | awk -F, '{sum+=$2}END{print sum}'
find . -name "*.br" -type f -delete
done
# for i in {0..9}
# do
# echo "[ GZIP ${i} ]"
# time {
# # find -name '*.html' -exec gzip -$i -k "{}" \;
# # find -name '*.js' -exec gzip -$i -k "{}" \;
# # find -name '*.css' -exec gzip -$i -k "{}" \;
# # find -name '*.wasm' -exec gzip -$i -k "{}" \;
# find -name '*.json' -exec gzip "{}" -kf"$i" \;
# }
# find . -name '*.gz' -exec stat -c %n,%s {} \; | awk -F, '{sum+=$2}END{print sum}'
# find . -name "*.gz" -type f -delete
# done
@CezaryDanielNowak
Copy link
Author

[ BROTLI 0 ]

real    2m2.125s
user    0m0.030s
sys     0m0.453s
28556594
[ BROTLI 1 ]

real    2m2.848s
user    0m0.045s
sys     0m0.774s
26861448
[ BROTLI 2 ]

real    2m2.385s
user    0m0.076s
sys     0m0.652s
23967128
[ BROTLI 3 ]

real    2m2.366s
user    0m0.060s
sys     0m0.588s
23713881
[ BROTLI 4 ]

real    2m3.074s
user    0m0.121s
sys     0m0.755s
22740382
[ BROTLI 5 ]

real    2m4.551s
user    0m0.121s
sys     0m0.737s
20914417
[ BROTLI 6 ]

real    2m5.986s
user    0m0.075s
sys     0m0.784s
20595020
[ BROTLI 7 ]

real    2m7.927s
user    0m0.075s
sys     0m0.634s
20316751
[ BROTLI 8 ]

real    2m17.233s
user    0m0.045s
sys     0m0.648s
20154431
[ BROTLI 9 ]

real    2m14.490s
user    0m0.060s
sys     0m0.849s
20010284
[ BROTLI 10 ]

real    3m33.786s
user    0m0.135s
sys     0m0.621s
18059262
[ BROTLI 11 ]

real    5m0.539s
user    0m0.090s
sys     0m0.847s
17462369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment