Date:2010-08-29 08:00:24 (9 years 21 days ago)
Author:Werner Almesberger
Commit:02e2bf542f9be8b1951511ee45182727b44495f1
Message:Optimize cache usage by symlinking identical PPMs.

- scripts/schhist2web (symlink): ln -sf two files. If the old file is a
symlink, link to its target instead of creating a chain of symlinks.
- scripts/schhist2web: if PPMs of the same file are identical in successive
commits, replace the new one with a symlink to the old one
Files: scripts/schhist2web (2 diffs)

Change Details

scripts/schhist2web
4040}
4141
4242
43symlink()
44{
45    local old=$1 new=$2
46    local src=`dirname "$new"`/$old
47
48    if [ -L "$src" ]; then
49    ln -sf "`readlink \"$src\"`" "$new"
50    else
51    ln -sf "$old" "$new"
52    fi
53}
54
55
4356commit_entry()
4457{
4558    # usage: commit_entry <base-dir> <commit>
...... 
181194    if [ ! -d "$cache/ppm_$n" ]; then
182195    rm -rf "$cache/ppm_$n"
183196    mkdir "$cache/ppm_$n"
197    #
198    # potential optimization here: remember Postscript files from previous
199    # run (or their md5sum) and check if they have changed. If not, skip
200    # the ghostscript run and just put a symlink, replacing the less
201    # efficient optimization below.
202    #
184203    gitsch2ppm $sanitize -k "$dir" "$schname" $n "$cache/ppm_$n" || exit
185204    gitsch2ppm -c -w 500 "$dir" "$schname" $n "$cache/fat_$n" || exit
186205    fi
187206    for m in "$cache/ppm_$n/"*; do
188207    [ "$m" = "$cache/ppm_$n/*" ] && break
208    if [ ! -z "$head" ]; then
209        prev="$cache/ppm_$head"/`basename "$m"`
210        if [ -r "$prev" ] && cmp -s "$prev" "$m"; then
211        symlink "../ppm_$head"/`basename "$m"` "$m"
212        symlink "../fat_$head"/`basename "$m"` \
213          "$cache/fat_$n"/`basename "$m"`
214        fi
215    fi
189216    touch "$out/names/"`basename "$m" .ppm`
190217    done
191218    trap 0

Archive Download the corresponding diff file



interactive