[Assorted-commits] SF.net SVN: assorted:[1165] serialization-bench/trunk
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-02-05 09:41:19
|
Revision: 1165 http://assorted.svn.sourceforge.net/assorted/?rev=1165&view=rev Author: yangzhang Date: 2009-02-05 09:41:13 +0000 (Thu, 05 Feb 2009) Log Message: ----------- - added a simple analysis (plotting) tool - added some sample data Added Paths: ----------- serialization-bench/trunk/data/ serialization-bench/trunk/data/log serialization-bench/trunk/tools/ serialization-bench/trunk/tools/analysis.py Added: serialization-bench/trunk/data/log =================================================================== --- serialization-bench/trunk/data/log (rev 0) +++ serialization-bench/trunk/data/log 2009-02-05 09:41:13 UTC (rev 1165) @@ -0,0 +1,26 @@ +TIMES +raw: 50 +raw: 50 +raw: 51 +htonl: 51 +htonl: 52 +htonl: 51 +fstream: 251 +fstream: 250 +fstream: 248 +boost: 42 +boost: 42 +boost: 42 +protobuf: 48 +protobuf: 69 +protobuf: 47 +many protobufs: 334 +many protobufs: 337 +many protobufs: 338 +SIZES +raw.out: 4000000 +htonl.out: 4000000 +fstream.out: 10982555 +boost.out: 4000039 +protobuf.out: 3983488 +manyprotos.out: 3983488 Copied: serialization-bench/trunk/tools/analysis.py (from rev 1160, container-bench/trunk/tools/analysis.py) =================================================================== --- serialization-bench/trunk/tools/analysis.py (rev 0) +++ serialization-bench/trunk/tools/analysis.py 2009-02-05 09:41:13 UTC (rev 1165) @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +from __future__ import with_statement +import sys, itertools, colorsys +from pylab import * + +# Parse the data. +pairs = ( line.split(': ') + for line in itertools.takewhile(lambda line: 'SIZES' not in line, + sys.stdin) + if ': ' in line ) +pairs = sorted( (a, int(b.split()[0])) for (a,b) in pairs ) + +# Aggregate the data. +def f(): + for key, group in itertools.groupby(pairs, lambda (a,b): a): + print key + a = array([b for a,b in group]) + yield key, a.mean(), a.std() + +# Sort the data into groups (based on type of operation). +pairs = sorted(f()) +groups = map(lambda (key, group): (key, list(group)), + itertools.groupby(pairs, lambda x: 0)) + +# Prepare plotting data. +labels, means, sds = zip(*pairs) +xs = arange(len(labels))+.5 +width = .5 + +# Prepare plotting parameters. +step = 1.0 / len(groups) +colors = ( colorsys.hls_to_rgb(step * i, .7, .5) for i in itertools.count() ) +ecolors = ( colorsys.hls_to_rgb(step * i, .3, .5) for i in itertools.count() ) + +# Plot! +start = 0 +for key, group in groups: + stop = start + len(group) + col = colors.next() + bar(xs[start:stop], means[start:stop], yerr = sds[start:stop], width = width, + color = col, edgecolor = col, ecolor = ecolors.next()) + start = stop + +# Annotate. +title("Performance of serialization techniques/libraries") +ylabel("Time (ms)") +xlim(0, xs[-1] + width*2) +xticks(xs + width/2, labels, rotation = 90) +# Make space for the vertically rotated labels. +gcf().subplots_adjust(bottom = .3) +# Show only bottom/left ticks. +gca().get_xaxis().tick_bottom() +gca().get_yaxis().tick_left() + +# Output. +savefig('results.png') Property changes on: serialization-bench/trunk/tools/analysis.py ___________________________________________________________________ Added: svn:executable + * Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |