You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2012/07/06 00:44:03 UTC
svn commit: r1357981 - in /subversion/trunk/tools/dev/benchmarks/suite1:
benchmark.py run
Author: neels
Date: Thu Jul 5 22:44:02 2012
New Revision: 1357981
URL: http://svn.apache.org/viewvc?rev=1357981&view=rev
Log:
Some tweaks on benchmark suite1 and remove/clarify reversing confusion.
* tools/dev/benchmarks/suite1/benchmark.py:
(do_div, do_diff):
Reverse and more clearly name params, to avoid swapping confusion. This
in effect reverses/fixes 'chart compare' subcommand.
(perform_run):
Make propsets ten times less likely, there were way too many propset
timings growing the database. And another cosmetic change.
(n_label, cmdline_show): show 'N' column with SI units (>= 1000).
(cmdline_compare):
SI units for 'N' column, and reverse the maths, so one doesn't need to
reverse cmdline args. Half the reverse is from do_div()/do_diff().
* tools/dev/benchmarks/suite1/run:
Introduce SVNBENCH_SUMMARY_ONLY flag, rename DEBUG to SVNBENCH_DEBUG,
make N=1 for SVN_A more clear and fix missing '@SVN_B_REV' for 'show'.
Modified:
subversion/trunk/tools/dev/benchmarks/suite1/benchmark.py
subversion/trunk/tools/dev/benchmarks/suite1/run
Modified: subversion/trunk/tools/dev/benchmarks/suite1/benchmark.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/benchmarks/suite1/benchmark.py?rev=1357981&r1=1357980&r2=1357981&view=diff
==============================================================================
--- subversion/trunk/tools/dev/benchmarks/suite1/benchmark.py (original)
+++ subversion/trunk/tools/dev/benchmarks/suite1/benchmark.py Thu Jul 5 22:44:02 2012
@@ -180,6 +180,29 @@ def next_unique_basename(prefix):
return '_'.join((prefix, str(_next_unique_basename_count)))
+si_units = [
+ (1000 ** 5, 'P'),
+ (1000 ** 4, 'T'),
+ (1000 ** 3, 'G'),
+ (1000 ** 2, 'M'),
+ (1000 ** 1, 'K'),
+ (1000 ** 0, ''),
+ ]
+def n_label(n):
+ """(stolen from hurry.filesize)"""
+ for factor, suffix in si_units:
+ if n >= factor:
+ break
+ amount = int(n/factor)
+ if isinstance(suffix, tuple):
+ singular, multiple = suffix
+ if amount == 1:
+ suffix = singular
+ else:
+ suffix = multiple
+ return str(amount) + suffix
+
+
def split_arg_once(l_r, sep):
if not l_r:
return (None, None)
@@ -227,14 +250,14 @@ PATHNAME_VALID_CHARS = "-_.,@%s%s" % (st
def filesystem_safe_string(s):
return ''.join(c for c in s if c in PATHNAME_VALID_CHARS)
-def do_div(a, b):
- if b:
- return float(a) / float(b)
+def do_div(ref, val):
+ if ref:
+ return float(val) / float(ref)
else:
return 0.0
-def do_diff(a, b):
- return float(a) - float(b)
+def do_diff(ref, val):
+ return float(val) - float(ref)
# ------------------------- database -------------------------
@@ -606,7 +629,8 @@ def perform_run(batch, run_kind,
def _mod(path):
if os.path.isdir(path):
- return _propmod(path)
+ _propmod(path)
+ return
f = open(path, 'a')
f.write('\n%s\n' % randstr())
@@ -708,7 +732,7 @@ def perform_run(batch, run_kind,
st(wc)
ci(wc)
up(wc)
- propadd_tree(trunk, 0.5)
+ propadd_tree(trunk, 0.05)
ci(wc)
up(wc)
st(wc)
@@ -868,15 +892,15 @@ def cmdline_show(db, options, *run_kind_
s = []
s.append('Timings for %s' % run_kind.label)
- s.append(' N min max avg operation (unit is seconds)')
+ s.append(' N min max avg operation (unit is seconds)')
for command_name in q.get_sorted_command_names():
if options.command_names and command_name not in options.command_names:
continue
n, tmin, tmax, tavg = timings[command_name]
- s.append('%5d %7.2f %7.2f %7.2f %s' % (
- n,
+ s.append('%4s %7.2f %7.2f %7.2f %s' % (
+ n_label(n),
tmin,
tmax,
tavg,
@@ -921,7 +945,7 @@ def cmdline_compare(db, options, left_st
left_N, left_min, left_max, left_avg = left[command_name]
right_N, right_min, right_max, right_avg = right[command_name]
- N_str = '%d/%d' % (left_N, right_N)
+ N_str = '%s/%s' % (n_label(left_N), n_label(right_N))
avg_str = '%7.2f|%+7.3f' % (do_div(left_avg, right_avg),
do_diff(left_avg, right_avg))
@@ -938,8 +962,8 @@ def cmdline_compare(db, options, left_st
s.extend([
'(legend: "1.23|+0.45" means: slower by factor 1.23 and by 0.45 seconds;',
- ' factor < 1 and difference < 0 means \'%s\' is faster.'
- % left_kind.label,
+ ' factor < 1 and seconds < 0 means \'%s\' is faster.'
+ % right_kind.label,
' "2/3" means: \'%s\' has 2 timings on record, the other has 3.)'
% left_kind.label
])
Modified: subversion/trunk/tools/dev/benchmarks/suite1/run
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/benchmarks/suite1/run?rev=1357981&r1=1357980&r2=1357981&view=diff
==============================================================================
--- subversion/trunk/tools/dev/benchmarks/suite1/run (original)
+++ subversion/trunk/tools/dev/benchmarks/suite1/run Thu Jul 5 22:44:02 2012
@@ -18,7 +18,10 @@
# under the License.
# debug? Just uncomment.
-#DEBUG=DEBUG_
+#SVNBENCH_DEBUG=DEBUG_
+if [ -n "$SVNBENCH_DEBUG" ]; then
+ SVNBENCH_DEBUG="DEBUG_"
+fi
# Subversion bin-dir used for maintenance of working copies
SVN_STABLE="$HOME/pat/stable/prefix/bin/"
@@ -29,31 +32,30 @@ SVN_STABLE="$HOME/pat/stable/prefix/bin/
SVN_A_NAME="1.7.0"
SVN_A="$HOME/pat/bench/prefix/bin"
SVN_A_REV="$("$SVN_STABLE"/svnversion -c "$HOME/pat/bench/src" | sed 's/.*://')"
-SVN_A_LABEL="$SVN_A_NAME@$SVN_A_REV"
# side B
SVN_B_NAME="trunk"
SVN_B="$HOME/pat/trunk/prefix/bin"
SVN_B_REV="$("$SVN_STABLE"/svnversion -c "$HOME/pat/trunk/src" | sed 's/.*://')"
-SVN_B_LABEL="$SVN_B_NAME@$SVN_B_REV"
-echo "$SVN_A_LABEL vs. $SVN_B_LABEL"
+echo "$SVN_A_NAME@$SVN_A_REV vs. $SVN_B_NAME@$SVN_B_REV"
# benchmark script and parameters...
benchmark="$PWD/benchmark.py"
-db="$PWD/${DEBUG}benchmark.db"
+db="$PWD/${SVNBENCH_DEBUG}benchmark.db"
batch(){
levels="$1"
spread="$2"
N="$3"
- # SVN_A is a fixed tag, say 1.7.0. For each call, run this once.
+ # SVN_A is a fixed tag, currently 1.7.0. For each call, run this once.
# It will be called again and again for each trunk build being tested,
# that's why we don't really need to run it $N times every time.
+ N_for_A=1
"$benchmark" "--db-path=$db" "--svn-bin-dir=$SVN_A" \
- run "$SVN_A_NAME@$SVN_A_REV,${levels}x$spread" 1 >/dev/null
+ run "$SVN_A_NAME@$SVN_A_REV,${levels}x$spread" "$N_for_A" >/dev/null
# SVN_B is a branch, i.e. the moving target, benchmarked at a specific
# point in history each time this script is called. Run this $N times.
@@ -69,7 +71,7 @@ bs=1
cl=1
cs=100
-if [ -n "$DEBUG" ]; then
+if [ -n "$SVNBENCH_DEBUG" ]; then
echo "DEBUG"
N=1
al=1
@@ -90,9 +92,13 @@ echo "
This is intended to measure changes in performance of the local working
copy layer, *only*. These results are *not* generally true for everyone."
-batch $al $as $N
-batch $bl $bs $N
-batch $cl $cs $N
+if [ -z "$SVNBENCH_SUMMARY_ONLY" ]; then
+ batch $al $as $N
+ batch $bl $bs $N
+ batch $cl $cs $N
+else
+ echo "(not running benchmarks, just printing results on record.)"
+fi
echo ""
echo "Averaged-total results across all runs:"
@@ -122,7 +128,7 @@ echo ""
for lvlspr in "${al}x${as}" "${bl}x${bs}" "${cl}x${cs}" "" ; do
"$benchmark" "--db-path=$db" show "$SVN_A_NAME,$lvlspr"
echo --
- "$benchmark" "--db-path=$db" show "$SVN_B_NAME,$lvlspr"
+ "$benchmark" "--db-path=$db" show "$SVN_B_NAME@$SVN_B_REV,$lvlspr"
echo --
"$benchmark" "--db-path=$db" \
compare -v "$SVN_A_NAME,$lvlspr" "$SVN_B_NAME@$SVN_B_REV,$lvlspr"