29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
1 |
#!/usr/bin/env python
|
2 |
||
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
3 |
"""Plot the performance of different variants of the string routines
|
4 |
for one size.
|
|
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
5 |
"""
|
6 |
||
7 |
import libplot |
|
8 |
||
9 |
import pylab |
|
10 |
||
11 |
||
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
12 |
def plot(records, bytes): |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
13 |
records = [x for x in records if x.bytes==bytes] |
14 |
||
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
15 |
variants = libplot.unique(records, 'variant', prefer='this') |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
16 |
functions = libplot.unique(records, 'function') |
17 |
||
18 |
X = pylab.arange(len(functions)) |
|
44
by Michael Hope
Various plotting updates. |
19 |
width = 1.0/(len(variants)+1) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
20 |
|
21 |
colours = iter('bgrcmyk') |
|
22 |
||
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
23 |
pylab.figure(1).set_size_inches((16, 12)) |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
24 |
pylab.clf() |
25 |
||
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
26 |
for i, variant in enumerate(variants): |
27 |
heights = [] |
|
28 |
||
29 |
for function in functions: |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
30 |
matches = [x for x in records if x.variant==variant and x.function==function and x.alignment==8] |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
31 |
|
32 |
if matches: |
|
33 |
match = matches[0] |
|
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
34 |
heights.append(match.bytes*match.loops/match.elapsed/(1024*1024)) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
35 |
else: |
36 |
heights.append(0) |
|
37 |
||
38 |
pylab.bar(X+i*width, heights, width, color=colours.next(), label=variant) |
|
39 |
||
40 |
axes = pylab.axes() |
|
41 |
axes.set_xticklabels(functions) |
|
42 |
axes.set_xticks(X + 0.5) |
|
43 |
||
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
44 |
pylab.title('Performance of different variants for %d byte blocks' % bytes) |
45 |
pylab.ylabel('Rate (MB/s)') |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
46 |
pylab.legend(loc='upper left', ncol=3) |
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
47 |
pylab.grid() |
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
48 |
pylab.savefig('top-%06d.png' % bytes, dpi=72) |
30
by Michael Hope
Added more ranges. changed everything to MB/s. Account for the loop overhead. |
49 |
|
50 |
def main(): |
|
51 |
records = libplot.parse() |
|
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
52 |
|
49
by Michael Hope
Benchmark more sizes and alignments. Make the figures bigger to make the text smaller. Put the 'this' results first. |
53 |
for bytes in libplot.unique(records, 'bytes'): |
33
by Michael Hope
Various updates to the benchmark plotting scripts. |
54 |
plot(records, bytes) |
55 |
||
29
by Michael Hope
Added some scripts to run the benchmarks and to plot the results. |
56 |
pylab.show() |
57 |
||
58 |
if __name__ == '__main__': |
|
59 |
main() |