diff --git a/.github/workflows/ci_misc.yml b/.github/workflows/ci_misc.yml index 0cd25de316..dbbce8fdcd 100644 --- a/.github/workflows/ci_misc.yml +++ b/.github/workflows/ci_misc.yml @@ -37,6 +37,13 @@ jobs: build_type: Release test_threads: 1 # snippets create and delete files and some separate tests create/delete the same files + - name: "Performance clang17 libc++" + compiler: "clang-17" + build: performance + build_type: Release + test_threads: 2 + cxx_flags: "-stdlib=libc++" + - name: "Performance gcc11" compiler: "gcc-11" build: performance diff --git a/test/include/seqan3/test/performance/units.hpp b/test/include/seqan3/test/performance/units.hpp index ed40f0dc46..200c046410 100644 --- a/test/include/seqan3/test/performance/units.hpp +++ b/test/include/seqan3/test/performance/units.hpp @@ -38,12 +38,14 @@ inline benchmark::Counter bytes_per_second(size_t bytes) template inline size_t pairwise_cell_updates(sequences_range_t const & sequences_range, [[maybe_unused]] auto && align_cfg) { + using config_t = std::remove_cvref_t; + auto count_cells = [&](auto && seq1, auto && seq2) { size_t const columns = std::ranges::size(seq1) + 1; size_t const rows = std::ranges::size(seq2) + 1; - if constexpr (align_cfg.template exists()) + if constexpr (config_t::template exists()) { using std::get; auto const band_cfg = get(align_cfg); diff --git a/test/performance/io/format_vienna_benchmark.cpp b/test/performance/io/format_vienna_benchmark.cpp index 38e1189102..3c83c48579 100644 --- a/test/performance/io/format_vienna_benchmark.cpp +++ b/test/performance/io/format_vienna_benchmark.cpp @@ -26,18 +26,18 @@ inline constexpr size_t iterations_per_run = 1024; -inline std::string const header{"seq foobar blobber"}; -inline auto const rna_sequence = seqan3::test::generate_sequence(474, 0, 0); -auto const sequence = rna_sequence | seqan3::views::to_char | seqan3::ranges::to(); +static std::string const header{"seq foobar blobber"}; +static inline auto const rna_sequence = seqan3::test::generate_sequence(474, 0, 0); +static auto const sequence = rna_sequence | seqan3::views::to_char | seqan3::ranges::to(); -inline std::string const structure{"(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......." +static std::string const structure{"(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......." "(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......." "(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......." "(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......." "(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......." "(((((((..((((........)))).((((.........)))).....(((((.......))))))))))))......."}; -inline std::string const vienna_file = []() +static std::string const vienna_file = []() { std::string file{}; for (size_t idx = 0; idx < iterations_per_run; idx++) diff --git a/test/performance/io/lowlevel_stream_input_benchmark.cpp b/test/performance/io/lowlevel_stream_input_benchmark.cpp index 5035c41b76..8f00da87dc 100644 --- a/test/performance/io/lowlevel_stream_input_benchmark.cpp +++ b/test/performance/io/lowlevel_stream_input_benchmark.cpp @@ -47,41 +47,49 @@ void read_all(benchmark::State & state) } /* start benchmark */ - char c{}; // prevents optimisation if constexpr (id == tag::std_stream_it) { for (auto _ : state) { + char c{}; std::ifstream s{filename, std::ios::binary}; std::istream_iterator it{s}; std::istream_iterator e{}; for (; it != e; ++it) c += *it; + + benchmark::DoNotOptimize(c); } } else if constexpr (id == tag::std_streambuf_it) { for (auto _ : state) { + char c{}; std::ifstream s{filename, std::ios::binary}; std::istreambuf_iterator it{s}; std::istreambuf_iterator e{}; for (; it != e; ++it) c += *it; + + benchmark::DoNotOptimize(c); } } else if constexpr (id == tag::seqan3_streambuf_it) { for (auto _ : state) { + char c{}; std::ifstream s{filename, std::ios::binary}; seqan3::detail::fast_istreambuf_iterator it{*s.rdbuf()}; std::default_sentinel_t e{}; for (; it != e; ++it) c += *it; + + benchmark::DoNotOptimize(c); } } #ifdef SEQAN3_HAS_SEQAN2 @@ -89,11 +97,14 @@ void read_all(benchmark::State & state) { for (auto _ : state) { + char c{}; std::ifstream s{filename, std::ios::binary}; auto it = seqan2::Iter>{s}; for (; !seqan2::atEnd(it); ++it) c += *it; + + benchmark::DoNotOptimize(c); } } #endif diff --git a/test/performance/range/container_assignment_benchmark.cpp b/test/performance/range/container_assignment_benchmark.cpp index 7208781a31..e22ad21e64 100644 --- a/test/performance/range/container_assignment_benchmark.cpp +++ b/test/performance/range/container_assignment_benchmark.cpp @@ -86,7 +86,7 @@ static constexpr void resize(container_t & container, } #endif // SEQAN3_HAS_SEQAN2 -template typename container_t, typename alphabet_t> +template typename container_t, typename alphabet_t, typename... args> static void assign(benchmark::State & state) { auto random_sequence = []() constexpr @@ -99,10 +99,10 @@ static void assign(benchmark::State & state) #endif // SEQAN3_HAS_SEQAN2 }(); - container_t from{}; + container_t from{}; resize(from, vector_size); std::copy(std::ranges::begin(random_sequence), std::ranges::end(random_sequence), std::ranges::begin(from)); - container_t to{}; + container_t to{}; resize(to, vector_size); assignment_functor fn{}; diff --git a/test/performance/range/container_push_back_benchmark.cpp b/test/performance/range/container_push_back_benchmark.cpp index 32470ac9b8..b49bbdeada 100644 --- a/test/performance/range/container_push_back_benchmark.cpp +++ b/test/performance/range/container_push_back_benchmark.cpp @@ -29,14 +29,14 @@ using small_vec = seqan3::small_vector; // push_back // ============================================================================ -template