
Upgrading to the latest
CodSpeedHQ/action release
enables caching of instrument installations (like valgrind or perf),
removing the per-run apt install overhead. In practice this cuts about 2
minutes off most CodSpeed Action runs.
If you're using the shorthand @v4 version of the action, you're already good
to go! Otherwise, just bump the action version to @v4.2.0 or later.
And voilà! 🎉 Your performance feedback loop just got 2 minutes faster.
A few weeks ago,
a tweet by Boshen, the
creator of oxc project, highlighted that the CodSpeed GitHub Action was taking 2
minutes just to install dependencies. His investigation revealed that most of
the time was spent working on man-db updates. Bypassing this made him already
save 80s from the installation time.
While this could be done by the CodSpeed action automatically, we don't feel comfortable changing the host machine behavior and we believe this should be done in the runner image directly.
Still, we realized that we could leverage the Github Actions cache to speed up even more this process, completely caching the APT installation of the dependencies.
This led us to go from 223.3 seconds to 87.4 seconds on a sample project. Effectively saving 136 seconds (more than 2 minutes) per run1.
If you're using CodSpeed Macro Runners, the instruments are already installed in the image so it's even more efficient.
This new caching mechanism adds 2 action options to customize the behavior:
- uses: CodSpeedHQ/action@v4
with:
# ...
# [OPTIONAL]
# Enable caching of instrument installations (like valgrind or perf) to speed up
# subsequent workflow runs. Set to 'false' to disable caching. Defaults to 'true'.
cache-instruments: "true"
# [OPTIONAL]
# The directory to use for caching installations of instruments (like valgrind or perf).
# This will speed up subsequent workflow runs by reusing previously installed instruments.
# Defaults to $HOME/.cache/codspeed-action if not specified.
instruments-cache-dir: ""
Learn more in the CodSpeedHQ/action repository.