Skip to content

Commit 4b47191

Browse files
committed
add benches
1 parent 8e6a1f4 commit 4b47191

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

benches/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.test
2+
*.out

benches/benches_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package benches
2+
3+
import (
4+
"testing"
5+
6+
excelformulaparser "github.com/link-duan/excel-formula-parser"
7+
"github.com/xuri/efp"
8+
)
9+
10+
const benchFormula = `=+ AName- (-+-+-2^6) = {"A","B"} + @SUM(A1) + (@ERROR.TYPE(#VALUE!) = 2)`
11+
12+
func Benchmark_Parse(b *testing.B) {
13+
for i := 0; i < b.N; i++ {
14+
excelformulaparser.NewParser(benchFormula).Parse()
15+
}
16+
}
17+
18+
func Benchmark_efp(b *testing.B) {
19+
for i := 0; i < b.N; i++ {
20+
p := efp.ExcelParser()
21+
p.Parse(benchFormula)
22+
}
23+
}

benches/go.mod

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module benches
2+
3+
go 1.24.3
4+
5+
require (
6+
github.com/link-duan/excel-formula-parser v1.0.0-alpha // indirect
7+
github.com/xuri/efp v0.0.1 // indirect
8+
)
9+
10+
replace github.com/link-duan/excel-formula-parser => ../

benches/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/link-duan/excel-formula-parser v1.0.0-alpha h1:4sPszJdMqfaRSOFCqa+3ozKD11u2zOtAAJZA665RS28=
2+
github.com/link-duan/excel-formula-parser v1.0.0-alpha/go.mod h1:Vf4SsUVu/e/BF9ofoVa0NbiJmbfxaI/E0qHqX4k+WRw=
3+
github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8=
4+
github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=

0 commit comments

Comments
 (0)