diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp index 49990bd7..91cab3f8 100644 --- a/benchmarks/benchmarks.cpp +++ b/benchmarks/benchmarks.cpp @@ -191,6 +191,34 @@ int main(){ ); } + for (size_t i = 0; i < std::size(sizes); i++) { + MicroBenchmark bench("Vermicelli", sizes[i]); + run_benchmarks(sizes[i], MAX_LOOPS / sizes[i], matches[m], false, bench, + [&](MicroBenchmark &b) { + b.chars.set('a'); + ue2::truffleBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi); + memset(b.buf.data(), 'b', b.size); + }, + [&](MicroBenchmark &b) { + return vermicelliExec('a', 'b', b.buf.data(), b.buf.data() + b.size); + } + ); + } + + for (size_t i = 0; i < std::size(sizes); i++) { + MicroBenchmark bench("Reverse Vermicelli", sizes[i]); + run_benchmarks(sizes[i], MAX_LOOPS / sizes[i], matches[m], true, bench, + [&](MicroBenchmark &b) { + b.chars.set('a'); + ue2::truffleBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi); + memset(b.buf.data(), 'b', b.size); + }, + [&](MicroBenchmark &b) { + return rvermicelliExec('a', 'b', b.buf.data(), b.buf.data() + b.size); + } + ); + } + for (size_t i = 0; i < std::size(sizes); i++) { //we imitate the noodle unit tests std::string str; diff --git a/benchmarks/benchmarks.hpp b/benchmarks/benchmarks.hpp index 37326523..eb892e51 100644 --- a/benchmarks/benchmarks.hpp +++ b/benchmarks/benchmarks.hpp @@ -30,6 +30,7 @@ #include "nfa/shufticompile.h" #include "nfa/truffle.h" #include "nfa/trufflecompile.h" +#include "nfa/vermicelli.h" #include "hwlm/noodle_build.h" #include "hwlm/noodle_engine.h" #include "hwlm/noodle_internal.h"