Skip to content

more decimals

more decimals #31

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: 'Benchmarks'
# Controls when the workflow will run
on:
# Triggers the workflow on push or pr to master
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
reason:
description: 'The reason for running the workflow'
required: true
default: 'Manual Run'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "main-job"
benchmark:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Log run info
- name: Log run info
run: |
echo 🎉 The job was automatically triggered by a ${{ github.event_name }} event.
echo 🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!
echo Current directory is: ${{ github.workspace }}
# Print the reason for the manual run if applicable
- name: Print Manual Run Reason
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo 'Reason: ${{ github.event.inputs.reason }}'
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out code in repository
uses: actions/checkout@v4
# Install the .NET Core
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
# Restore/Build/Run
- name: Restore, Build, and Run Benchmarks
run: |
dotnet run --project Benchmarks/Benchmarks.csproj --configuration Release
# Add workflow summary
- name: Generate Markdown Summary from Benchmark JSON
run: |
echo "## 🚀 Benchmark Summary" > benchmark_summary.md
echo '| Method | Mean | Error | StdDev | Allocation |' >> benchmark_summary.md
echo '|--------|-----:|------:|-------:|-------:|' >> benchmark_summary.md
for file in BenchmarkDotNet.Artifacts/results/*.json; do
jq -r '
def nano: (. * 1000 | tostring | split(".") | .[0] + "." + (.[1] | .[0:4] // "0000"));
.Benchmarks[] |
.Statistics as $s |
"| \(.Method) | \($s.Mean | nano) ns | ±\($s.StandardError | nano) ns | \($s.StandardDeviation | nano) ns | \(.Memory.BytesAllocatedPerOperation) B |"
' "$file" >> benchmark_summary.md
done
cat benchmark_summary.md >> $GITHUB_STEP_SUMMARY
# Upload benchmark results as artifact
- name: Upload Benchmark Results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: BenchmarkDotNet.Artifacts/results/*.json