diff --git a/bench/compile-time/CMakeLists.txt b/bench/compile-time/CMakeLists.txt index 6676afd..dec7058 100644 --- a/bench/compile-time/CMakeLists.txt +++ b/bench/compile-time/CMakeLists.txt @@ -8,7 +8,10 @@ find_package(Threads REQUIRED) # runtime dependency on Google Benchmark. function(_ptn_ct_add_lit_tu N) - set(_tufile "${CMAKE_CURRENT_SOURCE_DIR}/ct_bench_lit_${N}.cpp") + # Generate into the build tree, not the source tree: writing to + # CMAKE_CURRENT_SOURCE_DIR dirtied the working tree on every + # configure, and the generated files must not be committed. + set(_tufile "${CMAKE_CURRENT_BINARY_DIR}/ct_bench_lit_${N}.cpp") file(WRITE "${_tufile}" "// compile-time literal-match benchmark – forces full instantiation\n" "// of the match-dispatch machinery with ${N} literal cases.\n\n" diff --git a/bench/compile-time/ct_bench_lit_128.cpp b/bench/compile-time/ct_bench_lit_128.cpp deleted file mode 100644 index 7bae0fc..0000000 --- a/bench/compile-time/ct_bench_lit_128.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// compile-time literal-match benchmark – forces full instantiation -// of the match-dispatch machinery with 128 literal cases. - -#include "ptn/patternia.hpp" - -constexpr int ct_lit_128(int v) noexcept { - using namespace ptn; - return match(v) - | on(ptn::lit(0) >> 0, - ptn::lit(1) >> 1, - ptn::lit(2) >> 2, - ptn::lit(3) >> 3, - ptn::lit(4) >> 4, - ptn::lit(5) >> 5, - ptn::lit(6) >> 6, - ptn::lit(7) >> 7, - ptn::lit(8) >> 8, - ptn::lit(9) >> 9, - ptn::lit(10) >> 10, - ptn::lit(11) >> 11, - ptn::lit(12) >> 12, - ptn::lit(13) >> 13, - ptn::lit(14) >> 14, - ptn::lit(15) >> 15, - ptn::lit(16) >> 16, - ptn::lit(17) >> 17, - ptn::lit(18) >> 18, - ptn::lit(19) >> 19, - ptn::lit(20) >> 20, - ptn::lit(21) >> 21, - ptn::lit(22) >> 22, - ptn::lit(23) >> 23, - ptn::lit(24) >> 24, - ptn::lit(25) >> 25, - ptn::lit(26) >> 26, - ptn::lit(27) >> 27, - ptn::lit(28) >> 28, - ptn::lit(29) >> 29, - ptn::lit(30) >> 30, - ptn::lit(31) >> 31, - ptn::lit(32) >> 32, - ptn::lit(33) >> 33, - ptn::lit(34) >> 34, - ptn::lit(35) >> 35, - ptn::lit(36) >> 36, - ptn::lit(37) >> 37, - ptn::lit(38) >> 38, - ptn::lit(39) >> 39, - ptn::lit(40) >> 40, - ptn::lit(41) >> 41, - ptn::lit(42) >> 42, - ptn::lit(43) >> 43, - ptn::lit(44) >> 44, - ptn::lit(45) >> 45, - ptn::lit(46) >> 46, - ptn::lit(47) >> 47, - ptn::lit(48) >> 48, - ptn::lit(49) >> 49, - ptn::lit(50) >> 50, - ptn::lit(51) >> 51, - ptn::lit(52) >> 52, - ptn::lit(53) >> 53, - ptn::lit(54) >> 54, - ptn::lit(55) >> 55, - ptn::lit(56) >> 56, - ptn::lit(57) >> 57, - ptn::lit(58) >> 58, - ptn::lit(59) >> 59, - ptn::lit(60) >> 60, - ptn::lit(61) >> 61, - ptn::lit(62) >> 62, - ptn::lit(63) >> 63, - ptn::lit(64) >> 64, - ptn::lit(65) >> 65, - ptn::lit(66) >> 66, - ptn::lit(67) >> 67, - ptn::lit(68) >> 68, - ptn::lit(69) >> 69, - ptn::lit(70) >> 70, - ptn::lit(71) >> 71, - ptn::lit(72) >> 72, - ptn::lit(73) >> 73, - ptn::lit(74) >> 74, - ptn::lit(75) >> 75, - ptn::lit(76) >> 76, - ptn::lit(77) >> 77, - ptn::lit(78) >> 78, - ptn::lit(79) >> 79, - ptn::lit(80) >> 80, - ptn::lit(81) >> 81, - ptn::lit(82) >> 82, - ptn::lit(83) >> 83, - ptn::lit(84) >> 84, - ptn::lit(85) >> 85, - ptn::lit(86) >> 86, - ptn::lit(87) >> 87, - ptn::lit(88) >> 88, - ptn::lit(89) >> 89, - ptn::lit(90) >> 90, - ptn::lit(91) >> 91, - ptn::lit(92) >> 92, - ptn::lit(93) >> 93, - ptn::lit(94) >> 94, - ptn::lit(95) >> 95, - ptn::lit(96) >> 96, - ptn::lit(97) >> 97, - ptn::lit(98) >> 98, - ptn::lit(99) >> 99, - ptn::lit(100) >> 100, - ptn::lit(101) >> 101, - ptn::lit(102) >> 102, - ptn::lit(103) >> 103, - ptn::lit(104) >> 104, - ptn::lit(105) >> 105, - ptn::lit(106) >> 106, - ptn::lit(107) >> 107, - ptn::lit(108) >> 108, - ptn::lit(109) >> 109, - ptn::lit(110) >> 110, - ptn::lit(111) >> 111, - ptn::lit(112) >> 112, - ptn::lit(113) >> 113, - ptn::lit(114) >> 114, - ptn::lit(115) >> 115, - ptn::lit(116) >> 116, - ptn::lit(117) >> 117, - ptn::lit(118) >> 118, - ptn::lit(119) >> 119, - ptn::lit(120) >> 120, - ptn::lit(121) >> 121, - ptn::lit(122) >> 122, - ptn::lit(123) >> 123, - ptn::lit(124) >> 124, - ptn::lit(125) >> 125, - ptn::lit(126) >> 126, - ptn::lit(127) >> 127, - _ >> 0); -} - -static_assert(ct_lit_128(0) == 0, ""); -static_assert(ct_lit_128(64) == 64, ""); -static_assert(ct_lit_128(127) == 127, ""); -static_assert(ct_lit_128(-1) == 0, ""); -static_assert(ct_lit_128(128) == 0, ""); diff --git a/bench/compile-time/ct_bench_lit_16.cpp b/bench/compile-time/ct_bench_lit_16.cpp deleted file mode 100644 index ee50d4f..0000000 --- a/bench/compile-time/ct_bench_lit_16.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// compile-time literal-match benchmark – forces full instantiation -// of the match-dispatch machinery with 16 literal cases. - -#include "ptn/patternia.hpp" - -constexpr int ct_lit_16(int v) noexcept { - using namespace ptn; - return match(v) - | on(ptn::lit(0) >> 0, - ptn::lit(1) >> 1, - ptn::lit(2) >> 2, - ptn::lit(3) >> 3, - ptn::lit(4) >> 4, - ptn::lit(5) >> 5, - ptn::lit(6) >> 6, - ptn::lit(7) >> 7, - ptn::lit(8) >> 8, - ptn::lit(9) >> 9, - ptn::lit(10) >> 10, - ptn::lit(11) >> 11, - ptn::lit(12) >> 12, - ptn::lit(13) >> 13, - ptn::lit(14) >> 14, - ptn::lit(15) >> 15, - _ >> 0); -} - -static_assert(ct_lit_16(0) == 0, ""); -static_assert(ct_lit_16(8) == 8, ""); -static_assert(ct_lit_16(15) == 15, ""); -static_assert(ct_lit_16(-1) == 0, ""); -static_assert(ct_lit_16(16) == 0, ""); diff --git a/bench/compile-time/ct_bench_lit_32.cpp b/bench/compile-time/ct_bench_lit_32.cpp deleted file mode 100644 index c522204..0000000 --- a/bench/compile-time/ct_bench_lit_32.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// compile-time literal-match benchmark – forces full instantiation -// of the match-dispatch machinery with 32 literal cases. - -#include "ptn/patternia.hpp" - -constexpr int ct_lit_32(int v) noexcept { - using namespace ptn; - return match(v) - | on(ptn::lit(0) >> 0, - ptn::lit(1) >> 1, - ptn::lit(2) >> 2, - ptn::lit(3) >> 3, - ptn::lit(4) >> 4, - ptn::lit(5) >> 5, - ptn::lit(6) >> 6, - ptn::lit(7) >> 7, - ptn::lit(8) >> 8, - ptn::lit(9) >> 9, - ptn::lit(10) >> 10, - ptn::lit(11) >> 11, - ptn::lit(12) >> 12, - ptn::lit(13) >> 13, - ptn::lit(14) >> 14, - ptn::lit(15) >> 15, - ptn::lit(16) >> 16, - ptn::lit(17) >> 17, - ptn::lit(18) >> 18, - ptn::lit(19) >> 19, - ptn::lit(20) >> 20, - ptn::lit(21) >> 21, - ptn::lit(22) >> 22, - ptn::lit(23) >> 23, - ptn::lit(24) >> 24, - ptn::lit(25) >> 25, - ptn::lit(26) >> 26, - ptn::lit(27) >> 27, - ptn::lit(28) >> 28, - ptn::lit(29) >> 29, - ptn::lit(30) >> 30, - ptn::lit(31) >> 31, - _ >> 0); -} - -static_assert(ct_lit_32(0) == 0, ""); -static_assert(ct_lit_32(16) == 16, ""); -static_assert(ct_lit_32(31) == 31, ""); -static_assert(ct_lit_32(-1) == 0, ""); -static_assert(ct_lit_32(32) == 0, ""); diff --git a/bench/compile-time/ct_bench_lit_64.cpp b/bench/compile-time/ct_bench_lit_64.cpp deleted file mode 100644 index 61c8ba9..0000000 --- a/bench/compile-time/ct_bench_lit_64.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// compile-time literal-match benchmark – forces full instantiation -// of the match-dispatch machinery with 64 literal cases. - -#include "ptn/patternia.hpp" - -constexpr int ct_lit_64(int v) noexcept { - using namespace ptn; - return match(v) - | on(ptn::lit(0) >> 0, - ptn::lit(1) >> 1, - ptn::lit(2) >> 2, - ptn::lit(3) >> 3, - ptn::lit(4) >> 4, - ptn::lit(5) >> 5, - ptn::lit(6) >> 6, - ptn::lit(7) >> 7, - ptn::lit(8) >> 8, - ptn::lit(9) >> 9, - ptn::lit(10) >> 10, - ptn::lit(11) >> 11, - ptn::lit(12) >> 12, - ptn::lit(13) >> 13, - ptn::lit(14) >> 14, - ptn::lit(15) >> 15, - ptn::lit(16) >> 16, - ptn::lit(17) >> 17, - ptn::lit(18) >> 18, - ptn::lit(19) >> 19, - ptn::lit(20) >> 20, - ptn::lit(21) >> 21, - ptn::lit(22) >> 22, - ptn::lit(23) >> 23, - ptn::lit(24) >> 24, - ptn::lit(25) >> 25, - ptn::lit(26) >> 26, - ptn::lit(27) >> 27, - ptn::lit(28) >> 28, - ptn::lit(29) >> 29, - ptn::lit(30) >> 30, - ptn::lit(31) >> 31, - ptn::lit(32) >> 32, - ptn::lit(33) >> 33, - ptn::lit(34) >> 34, - ptn::lit(35) >> 35, - ptn::lit(36) >> 36, - ptn::lit(37) >> 37, - ptn::lit(38) >> 38, - ptn::lit(39) >> 39, - ptn::lit(40) >> 40, - ptn::lit(41) >> 41, - ptn::lit(42) >> 42, - ptn::lit(43) >> 43, - ptn::lit(44) >> 44, - ptn::lit(45) >> 45, - ptn::lit(46) >> 46, - ptn::lit(47) >> 47, - ptn::lit(48) >> 48, - ptn::lit(49) >> 49, - ptn::lit(50) >> 50, - ptn::lit(51) >> 51, - ptn::lit(52) >> 52, - ptn::lit(53) >> 53, - ptn::lit(54) >> 54, - ptn::lit(55) >> 55, - ptn::lit(56) >> 56, - ptn::lit(57) >> 57, - ptn::lit(58) >> 58, - ptn::lit(59) >> 59, - ptn::lit(60) >> 60, - ptn::lit(61) >> 61, - ptn::lit(62) >> 62, - ptn::lit(63) >> 63, - _ >> 0); -} - -static_assert(ct_lit_64(0) == 0, ""); -static_assert(ct_lit_64(32) == 32, ""); -static_assert(ct_lit_64(63) == 63, ""); -static_assert(ct_lit_64(-1) == 0, ""); -static_assert(ct_lit_64(64) == 0, ""); diff --git a/bench/compile-time/ct_bench_lit_8.cpp b/bench/compile-time/ct_bench_lit_8.cpp deleted file mode 100644 index fdfad30..0000000 --- a/bench/compile-time/ct_bench_lit_8.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// compile-time literal-match benchmark – forces full instantiation -// of the match-dispatch machinery with 8 literal cases. - -#include "ptn/patternia.hpp" - -constexpr int ct_lit_8(int v) noexcept { - using namespace ptn; - return match(v) - | on(ptn::lit(0) >> 0, - ptn::lit(1) >> 1, - ptn::lit(2) >> 2, - ptn::lit(3) >> 3, - ptn::lit(4) >> 4, - ptn::lit(5) >> 5, - ptn::lit(6) >> 6, - ptn::lit(7) >> 7, - _ >> 0); -} - -static_assert(ct_lit_8(0) == 0, ""); -static_assert(ct_lit_8(4) == 4, ""); -static_assert(ct_lit_8(7) == 7, ""); -static_assert(ct_lit_8(-1) == 0, ""); -static_assert(ct_lit_8(8) == 0, "");