Open alexherbo2 opened 2 years ago
Some empirical measurements:
With a warmed cache:
hyperfine --export-markdown /dev/stdout \
--warmup=2 \
"find -L ~/.config/kak/autoload -type f -name '*\.kak'" \
"find -L ~/.config/kak/autoload -name .git -prune -o -type f -name '*\.kak'"
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
find -L ~/.config/kak/autoload -type f -name '*\.kak' |
4.8 ± 0.4 | 4.3 | 6.8 | 3.46 ± 0.40 |
find -L ~/.config/kak/autoload -name .git -prune -o -type f -name '*\.kak' |
1.4 ± 0.1 | 1.2 | 2.3 | 1.00 |
Explicitly flushing the disk cache before each run:
hyperfine --export-markdown /dev/stdout \
--prepare "echo 1 | sudo tee /proc/sys/vm/drop_caches" \
"find -L ~/.config/kak/autoload -type f -name '*\.kak'" \
"find -L ~/.config/kak/autoload -name .git -prune -o -type f -name '*\.kak'"
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
find -L ~/.config/kak/autoload -type f -name '*\.kak' |
68.3 ± 39.5 | 32.5 | 143.4 | 6.11 ± 9.23 |
find -L ~/.config/kak/autoload -name .git -prune -o -type f -name '*\.kak' |
11.2 ± 15.6 | 4.5 | 75.9 | 1.00 |
So, skipping .git
directories is a measurable improvement, but probably not much of one.
How many Git repositories were in the autoload?
Does a long Git history affect the startup time?
How many Git repositories were in the autoload?
printf '%s\n' ~/.config/kak/autoload/*/.git | wc -l
14
Does a long Git history affect the startup time?
It depends. A git repo with a lot of loose objects (in .git/objects/??/
) will probably take longer to scan than a repo whose objects are all in a single pack (in .git/objects/pack/
). A Git repo with a long history will have more objects, but it's also more likely that git gc
will have been run to collect loose objects into a pack.
The
find
command used in the runtime kakrc does not prune hidden files, such as.git
.The startup time can be slower if cloning repositories in the autoload.
Example:
It can also happen when backup files are created, since
.kak
files keep the same extension.