From 7c452bc9a4a7d0152c4761a51531303e56ad932d Mon Sep 17 00:00:00 2001 From: qlrd Date: Mon, 4 Nov 2024 22:42:11 -0300 Subject: [PATCH 1/3] added more OS to benchmark --- .github/workflows/benchmark.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a39311d..2fb5604 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -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 @@ -28,4 +44,4 @@ jobs: ./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 \ No newline at end of file + echo "Elapsed time: $((elapsed_time / 1000000)) ms" # Convert to milliseconds From 140ca63bed6b77b31291a3c6bed74b681408fd89 Mon Sep 17 00:00:00 2001 From: qlrd Date: Mon, 4 Nov 2024 22:51:39 -0300 Subject: [PATCH 2/3] added powershell for windows --- .github/workflows/benchmark.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 2fb5604..aeb4096 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -37,7 +37,8 @@ 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 @@ -45,3 +46,14 @@ jobs: 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" From 8352b07cb113081eb6c99da578924ad6202ea436 Mon Sep 17 00:00:00 2001 From: qlrd Date: Mon, 4 Nov 2024 22:58:14 -0300 Subject: [PATCH 3/3] added powershell for windows II --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index aeb4096..525e5af 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -38,7 +38,7 @@ jobs: run: cargo build --release - name: Run benchmark (unix) - if: ${{ matrix.os != "windows-latest" }} + if: ${{ matrix.os != 'windows-latest' }} run: | echo "Running benchmark for mining code..." start_time=$(date +%s%N) # Get start time in nanoseconds @@ -48,7 +48,7 @@ jobs: echo "Elapsed time: $((elapsed_time / 1000000)) ms" # Convert to milliseconds - name: Run benchmark (windows) - if: ${{ matrix.os == "windows-latest" }} + if: ${{ matrix.os == 'windows-latest' }} shell: pwsh run: | Write-Output "Running benchmark for mining code..."