about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-11-29T21·04+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-11-29T21·04+0000
commit71926ee18803071e64754465faf3d57d6dc9bbda (patch)
tree8982e67e7c3fa35b33d22815105d35e03b361bef
parent13f77276d11610171bc7774406b65b6cb73d453a (diff)
* Print out statistics comparing our performance to bzip2.
-rwxr-xr-xpatch/bdiff.sh24
1 files changed, 20 insertions, 4 deletions
diff --git a/patch/bdiff.sh b/patch/bdiff.sh
index 33d109bd8cbb..1515319738d3 100755
--- a/patch/bdiff.sh
+++ b/patch/bdiff.sh
@@ -1,6 +1,7 @@
 #! /bin/sh -e
 
-DIFF=/home/eelco/Dev/nix/zdelta-2.1/zdc
+#DIFF=/home/eelco/Dev/nix/zdelta-2.1/zdc
+DIFF=/home/eelco/Dev/nix/bsdiff-4.2/bsdiff
 
 srcA=$1
 srcB=$2
@@ -12,13 +13,28 @@ fi
 
 (cd $srcB && find . -type f) | while read fn; do
 
-    echo "$fn" >&2
-
     if test -f "$srcA/$fn"; then
 
 	echo "FILE DELTA FOR $fn"
 
-	$DIFF "$srcA/$fn" "$srcB/$fn"
+        TMPFILE=/tmp/__bsdiff
+	$DIFF "$srcA/$fn" "$srcB/$fn" $TMPFILE
+        cat $TMPFILE
+
+        diffSize=$(stat -c '%s' $TMPFILE)
+
+        # For comparison.
+        bzipSize=$(bzip2 < "$srcB/$fn" | wc -m)
+
+        gain=$(echo "scale=2; ($diffSize - $bzipSize) / $bzipSize * 100" | bc)
+
+        ouch=$(if test "${gain:0:1}" != "-"; then echo "!"; fi)
+
+        printf "%7.2f %1s %10d %10d %s\n" \
+            "$gain" "$ouch" "$diffSize" "$bzipSize" "$fn" >&2
+#        echo "$fn -> $diffSize $bzipSize ==> $gain  $ouch" >&2
+
+        rm $TMPFILE
 
     else