Further performance optimization and code cleanup.

This commit is contained in:
Maurice Makaay 2019-07-12 21:32:32 +00:00
parent b8d99972bb
commit 2fb6a5fd34
9 changed files with 23037 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -45,9 +45,9 @@ func main() {
fmt.Printf("cycle %d / %d, tokens=%d\r", i+1, *doProfile, len(result.Tokens))
}
duration := time.Since(start)
p.Stop()
fmt.Printf("\n")
fmt.Println("Duration:", duration)
p.Stop()
return
}
@ -284,7 +284,7 @@ func BuildGrammar() tokenize.Handler {
R("inline-table", tok.Group("inline-table", c.Seq(
G("inline-table-open"),
G("inline-table-keyvals"),
G("inline-table-keyvals").Optional(),
G("inline-table-close"))))
// Inline Array

Binary file not shown.

View File

@ -1,12 +1,28 @@
0.004 burntsushi tester with x
1.347 burntsushi profile cycle 1000 with x
0.005 parse2 non-profile mode with x
1.850 parse2 profile cycle 1000 with x
19.251 ./parse2 -p 100 < long.toml
22.386 ./parse2 -p 10000 < x
0.098 burntsushi with long.toml
0.950 burntsushi profile cycle 10 with long.toml
0.190 parse2 non-profile mode with long.toml
1.843 parse2 profile cycle 10 with long.toml
1.84591043s parse2 10 iteration profiling of long.toml
1.566912075s parse2 1000 iteration profiling of x
0.213 parse test set
0.239 burntsushi test set
984.177401ms burntsushi-tester 10 iteration profiling of long.toml
1.108335844s burntsushi-tester 1000 iteration profiling of x
0.002s git.makaay.nl/mauricem/go-toml/ast (unit tests)
0.324s git.makaay.nl/mauricem/go-toml/parse (unit tests)
0m0.246s BurntSushi test set
4.073716ms qa-array-inline-1000.toml
6.881482ms qa-array-inline-nested-1000.toml
5.271393ms qa-key-literal-40kb.toml
8.577264ms qa-key-string-40kb.toml
5.168562ms qa-scalar-literal-40kb.toml
8.401454ms qa-scalar-literal-multiline-40kb.toml
8.874881ms qa-scalar-string-40kb.toml
7.596715ms qa-scalar-string-multiline-40kb.toml
5.716824ms qa-table-inline-1000.toml
14.342319ms qa-table-inline-nested-1000.toml
185.826552ms qa-long-loads-of-comments.toml
0.190 time ./parse2 < long.toml
0.005 time ./parse2 < x

35
parse2/profile-qa.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
go build
$(cd ../cmd/burntsushi-tester/; go build)
DURATION=`./parse2 -p 10 < long.toml 2>&1 | grep Duration | awk '{print $2}'`
echo "$DURATION parse2 10 iteration profiling of long.toml"
DURATION=`./parse2 -p 1000 < x 2>&1 | grep Duration | awk '{print $2}'`
echo "$DURATION parse2 1000 iteration profiling of x"
echo ""
DURATION=`../cmd/burntsushi-tester/burntsushi-tester -p 10 < long.toml 2>&1 | grep Duration | awk '{print $2}'`
echo "$DURATION burntsushi-tester 10 iteration profiling of long.toml"
DURATION=`../cmd/burntsushi-tester/burntsushi-tester -p 1000 < x 2>&1 | grep Duration | awk '{print $2}'`
echo "$DURATION burntsushi-tester 1000 iteration profiling of x"
echo ""
(cd ..; make test) | awk '{print $3 " " $2 " (unit tests)"}'
echo ""
DURATION=`(cd ..; make test-sushi) 2>&1 | grep real | awk '{print $2}'`
echo $DURATION BurntSushi test set
echo ""
for F in ../parse/testfiles/valid/*/qa-*.toml; do
FILE=`basename $F`
DURATION=`cat $F | ./parse2 -p 1 2>&1 | grep Duration | awk '{print $2}'`
echo $DURATION $FILE
done

View File

@ -10,6 +10,6 @@
#ppfile=` | ./parse2 2>&1 | grep "cpu profiling enabled" | cut -d, -f2`
go build
ppfile=`cat long.toml | ./parse2 -p 10 2>&1 | grep "profiling enabled" | cut -d, -f2`
ppfile=`cat long.toml | ./parse2 -p 25 2>&1 | grep "profiling enabled" | cut -d, -f2`
go tool pprof -http 0.0.0.0:8888 ./parse2 $ppfile

View File

@ -1 +1 @@
x=1
key={key={}}

View File

@ -1,2 +0,0 @@
#!/bin/sh
/usr/bin/time -f '%Uu %Ss %er %MkB %C' "$@"