aboutsummaryrefslogtreecommitdiff
path: root/lib/parser/parser_benchmark_test.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2019-11-05 22:16:46 +0700
committerShulhan <m.shulhan@gmail.com>2020-03-01 22:54:24 +0700
commit2bca5ef4f69b8f33e76660dfd784fa2b3e2251c4 (patch)
tree89366ccf19686fc545c3871469308ecab7287ac9 /lib/parser/parser_benchmark_test.go
parent216584e664fc8898b13f931a582646803d8fa6fb (diff)
downloadpakakeh.go-2bca5ef4f69b8f33e76660dfd784fa2b3e2251c4.tar.xz
lib/parser: a general parser library
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)
+ }
+}