Squishing out more performance.

This commit is contained in:
Maurice Makaay 2019-07-12 00:20:52 +00:00
parent 83be756015
commit a9964163c1
4 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,7 @@ func main() {
flag.Usage() flag.Usage()
} }
toml, err := parse.Run(os.Stdin) toml, err := parse.RunWithoutSanityChecks(os.Stdin)
if err != nil { if err != nil {
log.Fatalf("Error decoding TOML: %s", err) log.Fatalf("Error decoding TOML: %s", err)
} else { } else {

View File

@ -57,3 +57,11 @@ func Run(input interface{}) (ast.Table, error) {
err := parse.New(p.startDocument)(input) err := parse.New(p.startDocument)(input)
return p.doc.Root, err return p.doc.Root, err
} }
// RunWithoutSanityChecks runs the TOML parser against the provided input data.
// The parsekit sanity checks are disabled during the parse run.
func RunWithoutSanityChecks(input interface{}) (ast.Table, error) {
p := newParser()
err := parse.New(p.startDocument)(input)
return p.doc.Root, err
}

View File

@ -12,7 +12,7 @@ import (
"github.com/pkg/profile" "github.com/pkg/profile"
) )
const runProfiler = false const runProfiler = true
func main() { func main() {
bytes, _ := ioutil.ReadAll(os.Stdin) bytes, _ := ioutil.ReadAll(os.Stdin)

Binary file not shown.