Skip to content

Speed Comparison

Speed Comparison #1114

name: Speed Comparison
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
run-time-benchmarks:
environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pull Requests' }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
class: [RepeatTests, BasicTest]
fail-fast: false
runs-on: ${{ matrix.os }}
concurrency:
group: "speed-comparison-run-time-${{matrix.os}}-${{matrix.class}}"
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Build TUnit AOT .NET 8.0
run: dotnet publish TUnitTimer.csproj -c Release --framework net8.0 --output aot-publish-net8 --property:Aot=true --runtime ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}
working-directory: "tools/speed-comparison/TUnitTimer/TUnitTimer"
- name: Build TUnit AOT .NET 9.0
run: dotnet publish TUnitTimer.csproj -c Release --framework net9.0 --output aot-publish-net9 --property:Aot=true --runtime ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}
working-directory: "tools/speed-comparison/TUnitTimer/TUnitTimer"
- name: Build TUnit Single File .NET 8.0
run: dotnet publish TUnitTimer.csproj -c Release --framework net8.0 --output singlefile-publish-net8 --property:SingleFile=true --runtime ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}
working-directory: "tools/speed-comparison/TUnitTimer/TUnitTimer"
- name: Build TUnit Single File .NET 9.0
run: dotnet publish TUnitTimer.csproj -c Release --framework net9.0 --output singlefile-publish-net9 --property:SingleFile=true --runtime ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}
working-directory: "tools/speed-comparison/TUnitTimer/TUnitTimer"
- name: Build TUnit
run: dotnet build -c Release
working-directory: "tools/speed-comparison/TUnitTimer"
- name: Build xUnit
run: dotnet build -c Release
working-directory: "tools/speed-comparison/xUnitTimer"
- name: Build NUnit
run: dotnet build -c Release
working-directory: "tools/speed-comparison/NUnitTimer"
- name: Build MSTest
run: dotnet build -c Release
working-directory: "tools/speed-comparison/MSTestTimer"
- name: Run Benchmark
run: ${{ matrix.os != 'windows-latest' && 'sudo -E ' || '' }}dotnet run -c Release --framework net9.0 --allCategories=Runtime
working-directory: "tools/speed-comparison/Tests.Benchmark"
env:
CLASS_NAME: ${{ matrix.class }}
- name: Upload Markdown
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.os }}_markdown_run_time_${{ matrix.class }}
path: |
**/BenchmarkDotNet.Artifacts/**
build-time-benchmarks:
environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pull Requests' }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# framework: [net8.0, net9.0]
fail-fast: false
runs-on: ${{ matrix.os }}
concurrency:
group: "speed-comparison-build-time-${{matrix.os}}"
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Run Benchmark
run: ${{ matrix.os != 'windows-latest' && 'sudo -E ' || '' }}dotnet run -c Release --allCategories=Build --framework net9.0
working-directory: "tools/speed-comparison/Tests.Benchmark"
- name: Upload Markdown
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.os }}_markdown_build_time
path: |
**/BenchmarkDotNet.Artifacts/**
generate-readme:
runs-on: ubuntu-latest
needs: [run-time-benchmarks, build-time-benchmarks]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Generate ReadMe
uses: ./.github/actions/execute-pipeline
with:
categories: ReadMe
admin-token: ${{ secrets.ADMIN_TOKEN }}
environment: Development