Skip to content

Instantly share code, notes, and snippets.

@kdmukai
Created January 9, 2025 15:10
Show Gist options
  • Save kdmukai/b82f74bf5ff4f84c60e98f999968c189 to your computer and use it in GitHub Desktop.
Save kdmukai/b82f74bf5ff4f84c60e98f999968c189 to your computer and use it in GitHub Desktop.
SeedSigner OS `ccache` performance scripts

These test scripts demonstrate the step-by-step speed ups that the various ccaches provide.

Scripted test sequence:

  • Start a build w/totally empty cache(s).
  • Rebuild the same target with the now populated cache(s).
  • Change to a new target and get some speedup via the populated cache(s).
  • Rebuild that target to get the full speedup.
  • ...repeat for the remaining two targets.

The first script is for a SeedSigner OS builder that only has the built-in BuildRoot ccache.

The second script is for a SeedSigner OS builder with the new additional "external" ccache.


To run these in the Docker container, you'll need to first add:

# Need the version of `time` that can write to a file
apt install time

And when running the first script in a SeedSigner OS Docker image that only has the BuildRoot internal ccache, you'll need to explictly add ccache to get the cache clearing and stat reporting:

apt install ccache
#!/bin/bash
# Test on a SeedSigner OS version that only has the BuildRoot ccache.
# Tests BR ccache's performance during a build sequence, starting from an empty cache.
touch results.txt
ccache -d /root/.buildroot-ccache -C
for device in pi0 pi0 pi02w pi02w pi2 pi2 pi4 pi4
do
ccache -d /root/.buildroot-ccache --zero-stats
echo "Building for: $device w/ongoing BR ccache" >> results.txt
/usr/bin/time -o results.txt -a ./build.sh --$device --app-repo=https://github.com/seedsigner/seedsigner.git --app-branch=0.8.5-rc1
echo "---------------------------------------------------" >> results.txt
ccache -d /root/.buildroot-ccache --show-stats >> results.txt
echo "---------------------------------------------------" >> results.txt
echo " " >> results.txt
done
cat results.txt
#!/bin/bash
# Test on a SeedSigner OS version that has the BuildRoot ccache AND the new "external" ccache.
# Tests the combined ccache performance during a build sequence, starting from empty caches.
touch results.txt
ccache -d /root/.buildroot-ccache -C
ccache -C
for device in pi0 pi0 pi02w pi02w pi2 pi2 pi4 pi4
do
ccache -d /root/.buildroot-ccache --zero-stats
ccache --zero-stats
echo "Building for: $device w/ongoing BR & external ccaches" >> results.txt
/usr/bin/time -o results.txt -a ./build.sh --$device --app-repo=https://github.com/seedsigner/seedsigner.git --app-branch=0.8.5-rc1
echo "---------------------------------------------------" >> results.txt
ccache -d /root/.buildroot-ccache --show-stats >> results.txt
echo "---------------------------------------------------" >> results.txt
ccache --show-stats >> results.txt
echo "---------------------------------------------------" >> results.txt
echo " " >> results.txt
done
cat results.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment