A tool to measure and compare the performance of different versions of Syft.
When making changes to Syft, particularly those that might affect performance, it's useful to measure the impact across different versions. This tool automates the process of:
- Fetching the latest release of Syft
- Building it from source
- Running performance tests
- Testing subsequent commits to main
- Comparing performance between branches (when testing PRs)
The tool generates a detailed Markdown report showing performance metrics for each tested version.
measure-syft is written in Python and requires a few dependencies.
- Python 3.x
- Git
- Go (for building Syft)
- Docker or Podman (for running container tests)
You can use either uv or Python's built-in venv to set up the environment:
Using uv:
git clone https://github.com/popey/measure-syft
cd measure-syft
uv venv
source ./venv/bin/activate
uv pip install requestsUsing venv:
git clone https://github.com/popey/measure-syft
cd measure-syft
python -m venv venv
source ./venv/bin/activate
pip install requestsThere are two main ways to use measure-syft:
To test all commits from the latest release to main:
./measure-syft.pyThis will:
- Find the latest Syft release
- Clone and build that version
- Run performance tests
- Test each subsequent commit up to main
- Generate a report in the
resultsdirectory
To compare main against a PR branch:
./measure-syft.py --pr feat/parallelize-file-hashingThis will:
- Build and test main
- Build and test the specified PR branch
- Generate a comparison report
The script uses several configuration variables that can be modified in the source:
test_container: The container image to use for testingiterations: Number of test runs per version (default: 5)build_dir: Where to clone and build Syftresults_dir: Where to store test resultsplatform: Container platform to test against
The script generates a Markdown report containing:
- Test date and time
- Container being tested
- Environment variables
- Table of results showing:
- Version/commit
- Minimum runtime
- Maximum runtime
- Average runtime
Example output:
# Syft Performance Test Results
Date: 2024-02-07 10:00:00
Container: docker.io/huggingface/transformers-all-latest-torch-nightly-gpu:latest
Environment Variables:
- SYFT_PARALLELISM=48
- SYFT_CHECK_FOR_APP_UPDATE=false
## Results
| Version/Description | Commit | Min (s) | Max (s) | Avg (s) |
|-------------------|--------|---------|---------|---------|
| v1.19.0 | - | 45.23 | 47.12 | 46.18 |
| Add parallel... | [abc123](https://...) | 42.11 | 43.89 | 43.00 |This tool is primarily designed for performance testing and comparison. The results can be affected by system load and other factors, so it's recommended to:
- Run tests multiple times
- Keep the test environment as consistent as possible
- Consider the min/max/average values rather than individual run times
MIT