Skip to content

added more OS to benchmark #6

added more OS to benchmark

added more OS to benchmark #6

Workflow file for this run

name: Benchmark Mining Code
on:
pull_request:
branches:
- main
jobs:
benchmark:
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x64
- os: windows-latest
arch: x64
- os: macos-13
arch: x64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: setup toolchain
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
- name: Build the project
run: cargo build --release
- name: Run benchmark (unix)
if: ${{ matrix.os != 'windows-latest' }}
run: |
echo "Running benchmark for mining code..."
start_time=$(date +%s%N) # Get start time in nanoseconds
./target/release/mining-btc
end_time=$(date +%s%N) # Get end time in nanoseconds
elapsed_time=$((end_time - start_time)) # Calculate elapsed time
echo "Elapsed time: $((elapsed_time / 1000000)) ms" # Convert to milliseconds
- name: Run benchmark (windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
Write-Output "Running benchmark for mining code..."
$startTime = [DateTime]::UtcNow.Ticks
./target/release/mining-btc
$endTime = [DateTime]::UtcNow.Ticks
$elapsedTime = ($endTime - $startTime) / 10000
Write-Output "Elapsed time: $elapsedTime ms"