Skip to content

Commit

Permalink
update benchmark [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Wing924 committed Jun 22, 2019
1 parent a55444a commit 98b9cea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bench/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.12

require (
github.com/Songmu/go-ltsv v0.0.0-20181014062614-c30af2b7b171
github.com/Wing924/ltsv v1.2.0
github.com/Wing924/ltsv v1.2.1-0.20190622134447-a55444a8b42e
github.com/najeira/ltsv v0.0.0-20150303073528-40eb84a5b5d2
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.3.0
Expand Down
2 changes: 2 additions & 0 deletions bench/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/Wing924/ltsv v0.1.1 h1:ZNz4j0Y7D2+ZKhuGK1H+bbTPnXKrn6uDiXjHDCWbMME=
github.com/Wing924/ltsv v0.1.1/go.mod h1:zl47wq7H23LocdDHg7yJAH/Qdc4MWHXu1Evx9Ahilmo=
github.com/Wing924/ltsv v1.2.0 h1:8LEXcOURm1f7EL3Q9Y+LYiHuNK9qBuQIPDLzUR+wfq0=
github.com/Wing924/ltsv v1.2.0/go.mod h1:zl47wq7H23LocdDHg7yJAH/Qdc4MWHXu1Evx9Ahilmo=
github.com/Wing924/ltsv v1.2.1-0.20190622134447-a55444a8b42e h1:JpoK7fQ5JZTAHmtKQ4cLxTNXuL1LEbk9Xnh38fUHMIA=
github.com/Wing924/ltsv v1.2.1-0.20190622134447-a55444a8b42e/go.mod h1:zl47wq7H23LocdDHg7yJAH/Qdc4MWHXu1Evx9Ahilmo=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
14 changes: 10 additions & 4 deletions bench/line_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,34 @@ var value = map[string]string{

// Wing924/ltsv
func Test_line_Wing924_ltsv(t *testing.T) {
m, err := Wing924.ParseLineAsMap(line, false, nil)
parser := Wing924.DefaultParser
parser.StrictMode = false
m, err := parser.ParseLineAsMap(line, nil)
assert.NoError(t, err)
assert.EqualValues(t, value, m)
}

func Test_line_Wing924_ltsv_strict(t *testing.T) {
m, err := Wing924.ParseLineAsMap(line, true, nil)
parser := Wing924.DefaultParser
m, err := parser.ParseLineAsMap(line, nil)
assert.NoError(t, err)
assert.EqualValues(t, value, m)
}

func Benchmark_line_Wing924_ltsv(b *testing.B) {
parser := Wing924.DefaultParser
parser.StrictMode = false
m := make(map[string]string, 17)
for i := 0; i < b.N; i++ {
Wing924.ParseLineAsMap(line, false, m)
parser.ParseLineAsMap(line, m)
}
}

func Benchmark_line_Wing924_ltsv_strict(b *testing.B) {
parser := Wing924.DefaultParser
m := make(map[string]string, 17)
for i := 0; i < b.N; i++ {
Wing924.ParseLineAsMap(line, true, m)
parser.ParseLineAsMap(line, m)
}
}

Expand Down

0 comments on commit 98b9cea

Please sign in to comment.