Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,12 @@ jobs:
build_configuration: 'Release'
- job_name: 'x64 (MSVC): Windows (VS 2022, debug)'
build_configuration: 'Debug'
# TODO: Resolve the issue and re-enable benchmark.
# See: https://github.com/bitcoin-core/minisketch/pull/96.
skip_benchmark: true
- job_name: 'x64 (MSVC): Windows (VS 2022, shared)'
cmake_options: '-DBUILD_SHARED_LIBS=ON'
build_configuration: 'Release'
- job_name: 'x64 (clang-cl): Windows (VS 2022)'
cmake_options: '-T ClangCL'
build_configuration: 'Release'
# TODO: Resolve the issue and re-enable benchmark.
# See: https://github.com/bitcoin-core/minisketch/pull/96.
skip_benchmark: true

steps:
- name: Checkout
Expand All @@ -64,6 +58,5 @@ jobs:
run: ctest --output-on-failure -j $env:NUMBER_OF_PROCESSORS -C ${{ matrix.configuration.build_configuration }}

- name: Benchmark
if: ${{ ! matrix.configuration.skip_benchmark }}
working-directory: build
run: bin\${{ matrix.configuration.build_configuration }}\bench.exe
9 changes: 8 additions & 1 deletion src/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "../include/minisketch.h"
#include <string.h>
#include <limits>
#include <memory>
#include <vector>
#include <chrono>
Expand Down Expand Up @@ -42,7 +43,13 @@ int main(int argc, char** argv) {
std::vector<minisketch*> states;
std::vector<uint64_t> roots(2 * syndromes);
std::random_device rng;
std::uniform_int_distribution<uint64_t> dist(1, (uint64_t(1) << bits) - 1);
uint64_t upper_bound;
if (bits < 64) {
upper_bound = (uint64_t(1) << bits) - 1;
} else {
upper_bound = std::numeric_limits<uint64_t>::max();
}
std::uniform_int_distribution<uint64_t> dist(1, upper_bound);
states.resize(iters);
std::vector<double> benches;
benches.reserve(iters);
Expand Down