|
1
|
#!/bin/sh |
|
2
|
# Throw-away cache size test scripts by Dan Shearer, Sep 2026 |
|
3
|
# Needs ../fossil built from the cache-speedups branch |
|
4
|
set -eu |
|
5
|
unset FOSSIL_SQLCACHE |
|
6
|
|
|
7
|
repository=${1:?usage: $0 repository.fossil} |
|
8
|
copy=${TMPDIR:-/tmp}/${repository##*/} |
|
9
|
mirror=$PWD/git-export-mirror |
|
10
|
trap 'rm -rf "$mirror" "$copy"' EXIT HUP INT TERM |
|
11
|
printf 'command\trepetition\tcache_n\telapsed\tuser\tsystem\tmax_rss_kb\n' |
|
12
|
cache_values=${CACHE_VALUES:-"500 1000 1500 2000 3000 5000"} |
|
13
|
if [ -n "${GIT_LIMIT:-}" ]; then |
|
14
|
set -- --limit "$GIT_LIMIT" |
|
15
|
else |
|
16
|
set -- |
|
17
|
fi |
|
18
|
for repetition in $(seq 1 "${REPEATS:-3}"); do |
|
19
|
for n in $(printf '%s\n' $cache_values | shuf); do |
|
20
|
export FOSSIL_CACHE_N=$n FOSSIL_CACHE_SZ=${CACHE_SZ:-1000000000} |
|
21
|
rm -rf "$mirror" |
|
22
|
git init -q "$mirror" |
|
23
|
cp "$repository" "$copy" |
|
24
|
/usr/bin/time -f "git-export\t$repetition\t$n\t%e\t%U\t%S\t%M" \ |
|
25
|
../fossil git export "$mirror" -R "$copy" "$@" -q -q |
|
26
|
done |
|
27
|
done |
|
28
|
|