From 4e0a4754f015d00801d8e69605c3c1375cd2a308 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Sat, 11 May 2024 22:02:53 +0200 Subject: [PATCH] Add benchmarks comparison job --- .github/workflows/osrm-backend.yml | 2 +- scripts/ci/post_benchmark_results.py | 2 +- src/benchmarks/packed_vector.cpp | 8 ++++---- src/benchmarks/static_rtree.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index 007edede7..dcc83a475 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -644,7 +644,7 @@ jobs: - name: Checkout Base Branch uses: actions/checkout@v3 with: - ref: ${{ github.event.pull_request.base.ref }} + ref: ${{ github.head_ref }} #${{ github.event.pull_request.base.ref }} path: base - name: Build Base Branch run: | diff --git a/scripts/ci/post_benchmark_results.py b/scripts/ci/post_benchmark_results.py index 8030944bd..6232b5a1d 100644 --- a/scripts/ci/post_benchmark_results.py +++ b/scripts/ci/post_benchmark_results.py @@ -18,7 +18,7 @@ def create_markdown_table(results): name = result['name'] base = result['base'].replace('\n', '
') pr = result['pr'].replace('\n', '
') - row = f"| `{name}` |
{base}
|
{pr}
|" + row = f"| {name} | {base} | {pr} |" rows.append(row) return f"{header}\n" + "\n".join(rows) diff --git a/src/benchmarks/packed_vector.cpp b/src/benchmarks/packed_vector.cpp index f327545ac..6278f0457 100644 --- a/src/benchmarks/packed_vector.cpp +++ b/src/benchmarks/packed_vector.cpp @@ -72,10 +72,10 @@ int main(int, char **) auto write_slowdown = result_packed.random_write_ms / result_plain.random_write_ms; auto read_slowdown = result_packed.random_read_ms / result_plain.random_read_ms; - std::cout << "random write:\n std::vector " << result_plain.random_write_ms - << " ms\n util::packed_vector " << result_packed.random_write_ms << " ms\n" + std::cout << "random write:\nstd::vector " << result_plain.random_write_ms + << " ms\nutil::packed_vector " << result_packed.random_write_ms << " ms\n" << "slowdown: " << write_slowdown << std::endl; - std::cout << "random read:\n std::vector " << result_plain.random_read_ms - << " ms\n util::packed_vector " << result_packed.random_read_ms << " ms\n" + std::cout << "random read:\nstd::vector " << result_plain.random_read_ms + << " ms\nutil::packed_vector " << result_packed.random_read_ms << " ms\n" << "slowdown: " << read_slowdown << std::endl; } diff --git a/src/benchmarks/static_rtree.cpp b/src/benchmarks/static_rtree.cpp index 3d27f6657..b9c6fdd2c 100644 --- a/src/benchmarks/static_rtree.cpp +++ b/src/benchmarks/static_rtree.cpp @@ -44,8 +44,8 @@ void benchmarkQuery(const std::vector &queries, } TIMER_STOP(query); - std::cout << name << " " << TIMER_MSEC(query) << "ms" - << ") -> " << TIMER_MSEC(query) / queries.size() << " ms/query " + std::cout << name << ": " << TIMER_MSEC(query) << "ms" + << " -> " << TIMER_MSEC(query) / queries.size() << " ms/query " << "(" << TIMER_MSEC(query) << "ms" << ")" << std::endl; }