hugovk / pypi-tools

Command-line Python scripts to do things with PyPI
https://hugovk.github.io/pypi-tools
23 stars 2 forks source link

Notes for optimising images #54

Open hugovk opened 1 year ago

hugovk commented 1 year ago

sequential

time for f in $(ls images/*.png); do optipng -o7 -zm1-9 $f; done

32m15s

parallel

https://www.freecodecamp.org/news/how-to-supercharge-your-bash-workflows-with-gnu-parallel-53aab0aea141/

brew install parallel optipng
time ls images/*.png | parallel optipng -o7 -zm1-9 {}

3m39s

monthly update steps

preconditions: set up pypinfo

python -m pip install -r requirements.txt
brew install parallel optipng

then:

cd ~/github/pypi-tools
git up
./get-data.sh
make -j 10
time ls images/*.png | parallel optipng -o7 -zm1-9 {}

git add data/*2022-08.json
git add images/
git commit -m "Add 2022-08 data"

or a bit easier (tested Feb 2023):

cd ~/github/pypi-tools
git up
make data
make -j 10
make compress

pre-commit run --all-files
git add README.md charts.md

git add data/*2024*
git add images/
git commit -m "Add 2024-01 data"