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