OK="OK"
   FAIL="FAIL"
 fi
+if [ "$1" = "-twice" ]; then
+  shift
+  TWICE=1
+fi
 
 COMPILER=$1
 shift
 if [ -z "$COMPILER" -o -z "$LOGFILE" -o -z "$TODO" ]; then
   echo
   echo "usage: "
-  echo "  do_tests.sh [-no-color] ./compiler logfile tests.ma ..."
+  echo "  do_tests.sh [-no-color] [-twice] ./compiler logfile tests.ma ..."
+  echo
+  echo "options:  "
+  echo "  -no-color Do not use vt100 colors"
+  echo "  -twice    Run each test twice but show only the second run times"
   echo
   echo "The value of the DO_TESTS_EXTRA evironment variable"
   echo "will be appended to each line."
 
 for T in $TODO; do
   echo -en "$COMPILER\t$T\t"
+  if [ "$TWICE" = "1" ]; then
+    $COMPILER $T 1>/dev/null 2>/dev/null
+  fi
   /usr/bin/time --quiet -o $TMP -f "%E\t%U\t%S" $COMPILER $T >> $LOGFILE 2>&1
   if [ $? = 0 ]; then
     echo -e "$OK\t`cat $TMP`\t$DO_TESTS_EXTRA"
 
   LOGTOOPT=/dev/null
   LOGTOBYTE=/dev/null
   export DO_TESTS_EXTRA="$MARK\t$@"
-  scripts/do_tests.sh -no-color ./matitac.opt $LOGTOOPT tests/*.ma
-  scripts/do_tests.sh -no-color ./matitac $LOGTOBYTE tests/*.ma
+  scripts/do_tests.sh -no-color -twice ./matitac.opt $LOGTOOPT tests/*.ma
+  scripts/do_tests.sh -no-color -twice ./matitac $LOGTOBYTE tests/*.ma
 }
 
 function compile {
   OLD=$PWD
   cd $1
   export OCAMLRUNPARAM='o=1000000'
-  testit "gc-off" 1>/dev/null 2>/dev/null
   testit "gc-off"
   export OCAMLRUNPARAM=''
-  testit "gc-on" 1>/dev/null 2>/dev/null
   testit "gc-on"
   cd $OLD
 }
 cvs -d $CVSROOT co helm/ocaml 1>/dev/null 2>/dev/null
 cvs -d $CVSROOT co helm/matita 1>/dev/null 2>/dev/null
 compile $PWD/helm/ocaml $PWD/helm/matita
-run_tests $PWD/helm/matita > LOG
+run_tests $PWD/helm/matita > LOG 2>/dev/null
 cat LOG | awk -f $PWD/helm/matita/scripts/insert.awk > INSERT.sql
 cat INSERT.sql | mysql -u helm -h mowgli.cs.unibo.it matita
 cd $OLD