Backup work on performance improvements.

This commit is contained in:
Maurice Makaay 2019-07-08 14:30:39 +00:00
parent 1d65cfdd7b
commit 30a0d80d84
4 changed files with 14 additions and 10 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"fmt"
"io/ioutil"
"log"
"math"
"os"
@ -12,16 +13,23 @@ import (
)
func main() {
bytes, _ := ioutil.ReadAll(os.Stdin)
input := string(bytes)
toml := BuildGrammar()
fmt.Printf("Reading TOML document from STDIN ...\n")
t := profile.Start() //profile.CPUProfile)
result, err := toml.Match(os.Stdin)
var result *tokenize.Result
var err error
for i := 0; i < 10; i++ {
fmt.Printf(".")
result, err = toml.Match(input)
}
t.Stop()
fmt.Printf("Completed reading document.\n")
if err != nil {
log.Fatalf("Error in parsing TOML: %s\n", err)
} else {
fmt.Printf("Result:\n")
for i, t := range result.Tokens() {
fmt.Printf("[%d] %v\n", i, t)
}

Binary file not shown.

View File

@ -9,11 +9,7 @@
#ppfile=` | ./parse2 2>&1 | grep "cpu profiling enabled" | cut -d, -f2`
echo "Building ..."
go build
echo "Running ..."
time cat long.toml | ./parse2 2>&1
echo "Profiling ..."
ppfile=`cat long.toml | time ./parse2 2>&1 | grep "cpu profiling enabled" | cut -d, -f2`
ppfile=`cat long.toml | time ./parse2 2>&1 | grep "profiling enabled" | cut -d, -f2`
go tool pprof -http 0.0.0.0:8888 ./parse2 $ppfile

View File

@ -1 +1 @@
c=[1]
x=1