Backup work on performance improvements.
This commit is contained in:
parent
1d65cfdd7b
commit
30a0d80d84
|
@ -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)
|
||||
}
|
||||
|
|
BIN
parse2/parse2
BIN
parse2/parse2
Binary file not shown.
|
@ -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
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
c=[1]
|
||||
x=1
|
||||
|
|
Loading…
Reference in New Issue