We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 124bbb1 commit aff8b69Copy full SHA for aff8b69
1 file changed
parser_bench_test.go
@@ -0,0 +1,32 @@
1
+package parser_test
2
+
3
+import (
4
+ "testing"
5
6
+ . "github.com/conventionalcommit/parser"
7
+)
8
9
+var sampleCommit = `feat(scope): description
10
11
+this is first line in body
12
13
+this is second line in body
14
15
+Ref: #123
16
+Date: 01-01-2021
17
+By: John Doe`
18
19
+// regex Compile everytime
20
+// BenchmarkParser-4 7255 156239 ns/op 126473 B/op 761 allocs/op
21
22
+// regex Compile once
23
+// BenchmarkParser-4 179227 6531 ns/op 1478 B/op 23 allocs/op
24
25
+func BenchmarkParser(b *testing.B) {
26
+ for i := 0; i < b.N; i++ {
27
+ _, err := Parse(sampleCommit)
28
+ if err != nil {
29
+ b.Fatal(err)
30
+ }
31
32
+}
0 commit comments