summaryrefslogtreecommitdiff
path: root/perf_test.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-13 15:28:43 +1000
committerAdam Scarr <adam@vektah.net>2017-08-13 15:28:43 +1000
commit79b7cc082cac1904b87bbe7996df5a8824f7c2d8 (patch)
tree6f97bfaf20629a77fc2a847fa82b0bcb5a5cc2af /perf_test.go
parente30b92276464f1a7cbd9e3772f315c990fac2073 (diff)
Add one byte prediction to Any()
Diffstat (limited to 'perf_test.go')
-rw-r--r--perf_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/perf_test.go b/perf_test.go
new file mode 100644
index 0000000..d6a0092
--- /dev/null
+++ b/perf_test.go
@@ -0,0 +1,14 @@
+package goparsify
+
+import "testing"
+
+func BenchmarkAny(b *testing.B) {
+ p := Any("hello", "goodbye", "help")
+
+ for i := 0; i < b.N; i++ {
+ _, _ = Run(p, "hello")
+ _, _ = Run(p, "hello world")
+ _, _ = Run(p, "good boy")
+ _, _ = Run(p, "help me")
+ }
+}