contrib: added revset performance benchmarking script
authorLucas Moscovicz <lmoscovicz@fb.com>
Fri, 14 Mar 2014 11:24:59 -0700
changeset 20745 5fb7c36d751f
parent 20744 9907b3f79ac2
child 20746 47fc466825da
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.
contrib/revsetbenchmarks.sh
--- /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"
+
+