Skip to content

Commit 7aed8dd

Browse files
committed
Keep track of benchmark results and pprof results.
beginning of a script to automate that. #mesureBeforeImprove
1 parent a53004e commit 7aed8dd

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
PASS
2+
BenchmarkNoCompression 100000 17658 ns/op
3+
BenchmarkCompression 200000 15520 ns/op
4+
BenchmarkRegExpLoop 2000 930384 ns/op
5+
ok github.com/ant0ine/go-json-rest/rest 7.198s
6+
PASS
7+
BenchmarkNoCompression 100000 16760 ns/op
8+
BenchmarkCompression 200000 14842 ns/op
9+
BenchmarkRegExpLoop 2000 935028 ns/op
10+
ok github.com/ant0ine/go-json-rest/rest 6.982s
11+
PASS
12+
BenchmarkNoCompression 100000 16570 ns/op
13+
BenchmarkCompression 200000 15455 ns/op
14+
BenchmarkRegExpLoop 2000 933782 ns/op
15+
ok github.com/ant0ine/go-json-rest/rest 7.088s

perf/pprof/cpu-a53004e-2014-08-16.txt

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
Total: 308 samples
2+
51 16.6% 16.6% 111 36.0% runtime.mallocgc
3+
21 6.8% 23.4% 22 7.1% settype
4+
19 6.2% 29.5% 19 6.2% scanblock
5+
18 5.8% 35.4% 19 6.2% runtime.MSpan_Sweep
6+
18 5.8% 41.2% 26 8.4% runtime.mapaccess1_faststr
7+
16 5.2% 46.4% 16 5.2% ExternalCode
8+
12 3.9% 50.3% 143 46.4% github.com/ant0ine/go-json-rest/rest/trie.(*node).find
9+
11 3.6% 53.9% 19 6.2% net/url.escape
10+
9 2.9% 56.8% 45 14.6% hash_insert
11+
8 2.6% 59.4% 60 19.5% cnew
12+
8 2.6% 62.0% 8 2.6% net/url.shouldEscape
13+
7 2.3% 64.3% 9 2.9% hash_init
14+
7 2.3% 66.6% 13 4.2% strings.genSplit
15+
6 1.9% 68.5% 21 6.8% runtime.growslice
16+
6 1.9% 70.5% 6 1.9% runtime.memclr
17+
5 1.6% 72.1% 93 30.2% github.com/ant0ine/go-json-rest/rest/trie.func·002
18+
5 1.6% 73.7% 5 1.6% runtime.markscan
19+
5 1.6% 75.3% 51 16.6% runtime.new
20+
4 1.3% 76.6% 189 61.4% github.com/ant0ine/go-json-rest/rest/trie.(*Trie).FindRoutesAndPathMatched
21+
4 1.3% 77.9% 4 1.3% github.com/ant0ine/go-json-rest/rest/trie.splitParam
22+
4 1.3% 79.2% 15 4.9% growslice1
23+
4 1.3% 80.5% 37 12.0% makemap_c
24+
4 1.3% 81.8% 4 1.3% runtime.mapaccess1_fast32
25+
4 1.3% 83.1% 4 1.3% runtime.markspan
26+
4 1.3% 84.4% 17 5.5% strings.SplitN
27+
3 1.0% 85.4% 21 6.8% MCentral_Grow
28+
3 1.0% 86.4% 4 1.3% assertE2Tret
29+
3 1.0% 87.3% 26 8.4% github.com/ant0ine/go-json-rest/rest.(*router).ofFirstDefinedRoute
30+
3 1.0% 88.3% 3 1.0% markonly
31+
3 1.0% 89.3% 3 1.0% runtime.memeqbody
32+
3 1.0% 90.3% 3 1.0% runtime.memhash
33+
2 0.6% 90.9% 2 0.6% flushptrbuf
34+
2 0.6% 91.6% 260 84.4% github.com/ant0ine/go-json-rest/rest.(*router).findRouteFromURL
35+
2 0.6% 92.2% 263 85.4% github.com/ant0ine/go-json-rest/rest.BenchmarkCompression
36+
2 0.6% 92.9% 39 12.7% github.com/ant0ine/go-json-rest/rest.escapedPath
37+
2 0.6% 93.5% 2 0.6% runtime.duffcopy
38+
2 0.6% 94.2% 2 0.6% runtime.fastrand1
39+
2 0.6% 94.8% 6 1.9% runtime.makeslice
40+
2 0.6% 95.5% 2 0.6% runtime.memcopy32
41+
2 0.6% 96.1% 2 0.6% runtime.memeq
42+
1 0.3% 96.4% 1 0.3% bgsweep
43+
1 0.3% 96.8% 20 6.5% net/url.(*URL).RequestURI
44+
1 0.3% 97.1% 24 7.8% runtime.cnew
45+
1 0.3% 97.4% 1 0.3% runtime.findfunc
46+
1 0.3% 97.7% 1 0.3% runtime.funcspdelta
47+
1 0.3% 98.1% 1 0.3% runtime.lock
48+
1 0.3% 98.4% 1 0.3% runtime.nanotime
49+
1 0.3% 98.7% 1 0.3% runtime.strcopy
50+
1 0.3% 99.0% 4 1.3% runtime.strhash
51+
1 0.3% 99.4% 1 0.3% runtime.stringiter2
52+
1 0.3% 99.7% 1 0.3% runtime.xadd
53+
1 0.3% 100.0% 1 0.3% scanbitvector
54+
0 0.0% 100.0% 28 9.1% GC
55+
0 0.0% 100.0% 1 0.3% MCentral_ReturnToHeap
56+
0 0.0% 100.0% 10 3.2% MHeap_AllocLocked
57+
0 0.0% 100.0% 1 0.3% MHeap_FreeLocked
58+
0 0.0% 100.0% 10 3.2% MHeap_Reclaim
59+
0 0.0% 100.0% 16 5.2% System
60+
0 0.0% 100.0% 1 0.3% clearpools
61+
0 0.0% 100.0% 1 0.3% concatstring
62+
0 0.0% 100.0% 1 0.3% copyout
63+
0 0.0% 100.0% 1 0.3% github.com/ant0ine/go-json-rest/rest.(*router).start
64+
0 0.0% 100.0% 1 0.3% github.com/ant0ine/go-json-rest/rest/trie.(*Trie).Compress
65+
0 0.0% 100.0% 67 21.8% github.com/ant0ine/go-json-rest/rest/trie.(*findContext).paramsAsMap
66+
0 0.0% 100.0% 1 0.3% github.com/ant0ine/go-json-rest/rest/trie.(*node).compress
67+
0 0.0% 100.0% 1 0.3% gostringsize
68+
0 0.0% 100.0% 4 1.3% makeslice1
69+
0 0.0% 100.0% 31 10.1% runtime.MCache_Refill
70+
0 0.0% 100.0% 31 10.1% runtime.MCentral_CacheSpan
71+
0 0.0% 100.0% 1 0.3% runtime.MCentral_FreeSpan
72+
0 0.0% 100.0% 14 4.5% runtime.MHeap_Alloc
73+
0 0.0% 100.0% 1 0.3% runtime.MHeap_Free
74+
0 0.0% 100.0% 4 1.3% runtime.assertE2T
75+
0 0.0% 100.0% 1 0.3% runtime.call16
76+
0 0.0% 100.0% 37 12.0% runtime.cnewarray
77+
0 0.0% 100.0% 1 0.3% runtime.concatstring2
78+
0 0.0% 100.0% 1 0.3% runtime.gc
79+
0 0.0% 100.0% 264 85.7% runtime.gosched0
80+
0 0.0% 100.0% 37 12.0% runtime.makemap
81+
0 0.0% 100.0% 45 14.6% runtime.mapassign1
82+
0 0.0% 100.0% 10 3.2% runtime.sweepone
83+
0 0.0% 100.0% 1 0.3% strings.Map
84+
0 0.0% 100.0% 1 0.3% strings.ToUpper
85+
0 0.0% 100.0% 1 0.3% sync.poolCleanup
86+
0 0.0% 100.0% 263 85.4% testing.(*B).launch
87+
0 0.0% 100.0% 263 85.4% testing.(*B).runN

perf/run.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
VERSION=`git log -1 --pretty=format:"%h-%ad" --date=short`
4+
5+
cd ../rest && go test -c && ./rest.test -test.bench="BenchmarkCompression" -test.cpuprofile="cpu.prof"
6+
cd ../rest && go tool pprof --text rest.test cpu.prof > ../perf/pprof/cpu-$VERSION.txt
7+
cd ../rest && rm -f rest.test cpu.prof
8+
9+
rm -f perf/bench/bench-$VERSION.txt
10+
cd ../rest && go test -bench=. >> ../perf/bench/bench-$VERSION.txt
11+
cd ../rest && go test -bench=. >> ../perf/bench/bench-$VERSION.txt
12+
cd ../rest && go test -bench=. >> ../perf/bench/bench-$VERSION.txt

0 commit comments

Comments
 (0)