From ed20271c2cc711d97f00dfd9872477c37cde708d Mon Sep 17 00:00:00 2001 From: Denis Yaroshevskiy Date: Mon, 14 Oct 2024 05:54:11 -0700 Subject: [PATCH] ] noexcept Summary: marking noinline functions as noexcept to help compiler optimizations. I didn't see effect in the microbenchmarks, but should be at least not worse. Reviewed By: yfeldblum Differential Revision: D64046213 --- folly/algorithm/simd/Contains.cpp | 9 +++++---- folly/algorithm/simd/Contains.h | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/folly/algorithm/simd/Contains.cpp b/folly/algorithm/simd/Contains.cpp index d5654714764..986a035b2e6 100644 --- a/folly/algorithm/simd/Contains.cpp +++ b/folly/algorithm/simd/Contains.cpp @@ -22,20 +22,21 @@ namespace folly::simd::detail { -bool containsU8(folly::span haystack, std::uint8_t needle) { +bool containsU8( + folly::span haystack, std::uint8_t needle) noexcept { return containsImpl(haystack, needle); } bool containsU16( - folly::span haystack, std::uint16_t needle) { + folly::span haystack, std::uint16_t needle) noexcept { return containsImpl(haystack, needle); } bool containsU32( - folly::span haystack, std::uint32_t needle) { + folly::span haystack, std::uint32_t needle) noexcept { return containsImpl(haystack, needle); } bool containsU64( - folly::span haystack, std::uint64_t needle) { + folly::span haystack, std::uint64_t needle) noexcept { return containsImpl(haystack, needle); } diff --git a/folly/algorithm/simd/Contains.h b/folly/algorithm/simd/Contains.h index 41117901e96..6a42a31e607 100644 --- a/folly/algorithm/simd/Contains.h +++ b/folly/algorithm/simd/Contains.h @@ -26,13 +26,14 @@ namespace detail { // no overloading for easier profiling. -bool containsU8(folly::span haystack, std::uint8_t needle); +bool containsU8( + folly::span haystack, std::uint8_t needle) noexcept; bool containsU16( - folly::span haystack, std::uint16_t needle); + folly::span haystack, std::uint16_t needle) noexcept; bool containsU32( - folly::span haystack, std::uint32_t needle); + folly::span haystack, std::uint32_t needle) noexcept; bool containsU64( - folly::span haystack, std::uint64_t needle); + folly::span haystack, std::uint64_t needle) noexcept; template using std_range_value_t = typename std::iterator_traits