Files
hosts/stats.sh
Michael Lohmann dd9bd42f52 stats.sh: process files in memory instead of on disk
Writing the file to the filesystem for all tags is unnecessary if the
content can just be parsed in memory. This improves the performance:

Here the output of `time ./stats.sh`:

old
./stats.sh  5.96s user 26.53s system 94% cpu 34.533 total

new
./stats.sh  5.85s user 22.86s system 102% cpu 28.040 total

So a reduction of 6.5s (23%) is achieved even on a computer with a
decent SSD.
2025-08-02 23:35:25 +02:00

14 lines
389 B
Bash
Executable File

#!/usr/bin/env bash
# clear file
true > stats.out
for TAG_DATE in $(git tag --sort=creatordate --format='%(refname:short),%(creatordate:short)'); do
# echo "$TAG_DATE"
split=(${TAG_DATE//,/ })
# echo ${split[0]}
entries=$(git show tags/${split[0]}:readmeData.json | jq '.base.entries')
if [[ -z "$entries" ]]; then continue; fi
echo ${split[1]},${entries} >> stats.out
done