aboutsummaryrefslogtreecommitdiff
path: root/lib/parser/parser_benchmark_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parser/parser_benchmark_test.go')
-rw-r--r--lib/parser/parser_benchmark_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/parser/parser_benchmark_test.go b/lib/parser/parser_benchmark_test.go
new file mode 100644
index 00000000..19e17872
--- /dev/null
+++ b/lib/parser/parser_benchmark_test.go
@@ -0,0 +1,23 @@
+// Copyright 2019, Shulhan <m.shulhan@gmail.com>. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package parser
+
+import "testing"
+
+// Output:
+//
+// BenchmarkParser_Token-4 59117898 20.2 ns/op 0 B/op 0 allocs/op
+//
+func BenchmarkParser_Token(b *testing.B) {
+ content := "abc;def"
+ delims := " /;"
+
+ p := New(content, delims)
+
+ for x := 0; x < b.N; x++ {
+ p.Token()
+ p.Load(content, delims)
+ }
+}