]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
add Vermicelli/RVermicelli to microbenchmark utility
authorKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Mon, 1 Nov 2021 12:48:17 +0000 (14:48 +0200)
committerKonstantinos Margaritis <markos@users.noreply.github.com>
Mon, 1 Nov 2021 14:53:21 +0000 (16:53 +0200)
benchmarks/benchmarks.cpp
benchmarks/benchmarks.hpp

index 49990bd7b36141706fe6101ac49b5689db89dc08..91cab3f8daec4582ff8540d3953e4b619e56a1f3 100644 (file)
@@ -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;
index 373265231602592955ae14a2a93ed93fce673770..eb892e515a9b3f9f81120368aa075ebb5bbd18b6 100644 (file)
@@ -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"