Fossil Forum
Post: `fossil ls -r` and `fossil tree` compute the age of every file even when it is not shown
ls_cmd_rev() in src/checkin.c always calls compute_fileage(rid,0) and joins every file with blob for its size. It does this whatever the options are. Plain fossil ls -r VERSION prints only the file names, and so does fossil tree, which calls ls_cmd_rev() with every flag 0. Yet both walk the history of every file to find when it last changed, and look up every file's size.
On a cold cache this dominates. On the Tcl repository (780 MB, on a USB hard disk, Fossil 2.29 trunk 06ef844171), listing the 2361 files of the trunk tip:
fossil ls -r HASH 9.4 s 54 MB read
fossil tree -r HASH 9.4 s 54 MB read
files_of_checkin('HASH') via sql 0.05 s 0.4 MB read
With a warm cache ls -r takes 0.08 s, so this only shows when the repository is not cached. That is the usual case the first time on a large repository, and it is a problem on Windows on a hard disk.
Only -v, --age, -t and the check-in info options need fileage; the size is needed only with -v. Could ls_cmd_rev() take the file names from files_of_checkin(), or from the manifest, when none of these options is given? Fossil 2.26, 2.28 and trunk behave the same.