Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added more OS to benchmark #9

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@ on:

jobs:
benchmark:
runs-on: ubuntu-latest

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
Expand All @@ -21,11 +37,23 @@ jobs:
- name: Build the project
run: cargo build --release

- name: Run benchmark
- 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
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"
Loading