mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parser: Improve TOML frontmatter parser performance
Difference between toml.Load(string(datum)) and toml.LoadReader(bytes.NewReader(datum)): benchmark old ns/op new ns/op delta BenchmarkLoad-4 82068 78489 -4.36% benchmark old allocs new allocs delta BenchmarkLoad-4 494 493 -0.20% benchmark old bytes new bytes delta BenchmarkLoad-4 17009 16913 -0.56%
This commit is contained in:
parent
68f4cd829e
commit
d3cd68e656
1 changed files with 1 additions and 2 deletions
|
@ -176,8 +176,7 @@ func HandleTOMLMetaData(datum []byte) (interface{}, error) {
|
||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
datum = removeTOMLIdentifier(datum)
|
datum = removeTOMLIdentifier(datum)
|
||||||
|
|
||||||
tree, err := toml.Load(string(datum))
|
tree, err := toml.LoadReader(bytes.NewReader(datum))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return m, err
|
return m, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue