changeset 20745:5fb7c36d751f

contrib: added revset performance benchmarking script This script takes two arguments (starting revision, ending revision) and tests for each revision in between the entire list of revsets in the script using perfrevset.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Fri, 14 Mar 2014 11:24:59 -0700
parents 9907b3f79ac2
children 47fc466825da
files contrib/revsetbenchmarks.sh
diffstat 1 files changed, 84 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/revsetbenchmarks.sh	Fri Mar 14 11:24:59 2014 -0700
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Measure the performance of a list of revsets on a range of revisions defined
+# by parameter. Checkout one by one and run perfrevset with every revset in the
+# list to benchmark its performance.
+#
+# First argument is the starting revision to measure performance
+# Second argument the ending revision to measure performance
+# Third argument is the file from which the revset array will be taken 
+#
+# You should run this from the root of your mercurial repository.
+#
+# This script also does one run of the current version of mercurial installed
+# to compare performance.
+
+HG="hg update"
+PERF="./hg perfrevset"
+BASE_PERF="hg perfrevset"
+
+START=$1
+END=$2
+readarray REVSETS < $3
+
+hg update --quiet
+
+echo "Starting time benchmarking"
+echo
+
+echo "Revsets to benchmark"
+echo "----------------------------"
+
+for (( j = 0; j < ${#REVSETS[@]}; j++ ));
+do
+  echo "${j}) ${REVSETS[$j]}"
+done
+
+echo "----------------------------"
+echo
+
+# Benchmark baseline
+echo "Benchmarking baseline"
+
+for (( j = 0; j < ${#REVSETS[@]}; j++ ));
+  do
+    echo -n "${j}) "
+    $BASE_PERF "${REVSETS[$j]}"
+done
+
+echo
+echo
+
+# Benchmark revisions
+for i in $(seq $START $END);
+do
+  echo "----------------------------"
+  echo -n "Revision: "
+  hg log -r $i --template "{desc|firstline}"
+
+  echo "----------------------------"
+  $HG $i
+  for (( j = 0; j < ${#REVSETS[@]}; j++ ));
+  do
+    echo -n "${j}) "
+    $PERF "${REVSETS[$j]}"
+  done
+  echo "----------------------------"
+done
+
+$HG
+
+# Benchmark current code
+echo "Benchmarking current code"
+
+for (( j = 0; j < ${#REVSETS[@]}; j++ ));
+  do
+    echo -n "${j}) "
+    $PERF "${REVSETS[$j]}"
+done
+
+
+echo
+echo "Time benchmarking finished"
+
+