The projection from #56 tested the scanned mount for being a snapshot as
well as the other one. On a system booted from a Snapper snapshot, as
openSUSE is by default, `/` is one, so every mark under `/var` or `/home`
was called another volume's although the scan walks them as its own.
Only the other mount is tested now, as `foreign_mounts` does.
The bulk listing from #53 is thought to report a mount point with the
attributes of the directory it covers, so its device would be the parent
volume's and the walk would cross into every disk, share and system
volume below the root. Directories are stated with `statat` again, as
`lstat` did before; files keep the bulk path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
human_bytes steps up a unit only at 1024, but above 9.95 it prints no decimal, so anything from 1023.5 to 1024 of a unit rounded to "1024 KiB" instead of "1.0 MiB" (1,048,575 bytes, for one). human_count had the same edge at 1000: 999,999 files read "1000.0k". Both now step up where the shown number would round to the next unit.
Bold alone lost to the hover fill: with the pointer on another row, two
rows were filled and nothing said which was saved. The saved preset now
keeps a check wherever the highlight goes, and the pointer moves the same
single highlight the arrow keys do. The menu is wider so Drain My Battery
still fits beside the check.
The free space meter measures the scanned volume, but the projection added
every marked target's bytes. A mark on another volume -- which -X crosses
into, and a disk mounted inside the tree can hold -- gives its space back
there, so the meter lent one disk another's.
Attribute each target to the volume its bytes return to, by the rule the
scan itself bounds a volume with (mount source and type, not a device
number), and project only what comes back to the scanned volume. Marks on
other volumes, snapshot subvolumes, and paths the mount table cannot place
are reported as "not counted here" rather than added; every marked target
is still removable, and the delete list still totals every byte.
A home directory of 2.6 million directories and 17 million files is
19.7 million nodes, so every field of Node is paid that many times: its
120 bytes were 2.36 GB of the scan's 3.27 GB peak.
- own_bytes and own_files are no longer stored. After aggregate a leaf's
own figures always equal its totals, and only the selection line reads
a directory's, so Node::own_bytes() and own_files() sum the direct
children when asked. A leaf's bytes is now the measured size and the
only input; de-duplication zeroes it for a second name, as it zeroed
own_bytes before.
- dirs is a u32, which packs beside the one-byte fields.
- inode is Option<(u64, NonZeroU64)>: no file has inode or file record
zero, so None fits in the niche and the pair costs 16 bytes, not 24.
Node::identity() gives the plain pair.
On the same home directory, peak memory for a scan falls from 3,267 MB
to 2,588 MB and node storage from 2,359 MB to 1,731 MB. Trees are
identical to upstream's with de-duplication off (1.25 million nodes
across ~/src, /Applications and /System/Applications, both size modes),
and the totals are identical with it on. a_node_stays_small holds the
size on 64-bit targets.
On macOS the walk listed each directory with std::fs::read_dir and then
called DirEntry::metadata for every file, an lstat of its full path, plus
one more per directory for the dataless flag and the device. On a home
directory of 2.6 million directories and 17 million files that is some
20 million system calls on top of the listing, each of which makes the
kernel set up per-file state.
macos.rs lists a directory with getattrlistbulk(2), which returns the
name, type, device, inode, modification time, flags, link count and sizes
of a whole buffer of entries per call, the way windows.rs already does
with FileIdExtdDirectoryInfo. The sizes are the ones stat reports:
ATTR_FILE_ALLOCSIZE is st_blocks * 512 (every fork, as st_blocks counts),
ATTR_FILE_DATALENGTH is st_size (the data fork). Checked against lstat on
151,000 files across system apps, app bundles, ~/Library and source
trees, and by a test with sparse, hardlinked, symlinked and
resource-forked files. An entry a file system describes only in part is
read with statat relative to the open directory.
Measured on an M5 Pro with 15 walk threads, warm and otherwise idle,
alternating with upstream/main:
~/src (88k directories, 696k files) 4.3-4.5 s -> 2.0 s
whole home directory (2.6M, 17M) 116.6 s -> 90.4-91.6 s
User CPU for the home scan fell from 24.6 s to 9.6 s, and system CPU
from 630 s to 430 s. Trees are identical to the standard listing's with
hardlink de-duplication off (3.3 million nodes, both size modes); with it
on the totals are identical, and which name of a hardlinked file is
charged varies as it already did between runs.
Linux keeps the standard listing, whose DirEntry::metadata is already a
statx relative to the directory; Windows keeps its own.
export::line wrote a path as plain whenever it had no control characters, but display() shows a name that is not valid Unicode with U+FFFD in place of its bytes, so the delete list and the agent prompt named a path that does not exist as one to use. Such a path now goes to the escaped branch, flagged, like a name with a control character.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`examples/scan_workers` runs one scan with a fixed pool of N workers, the
way a preset does, and prints its counts as JSON.
`scripts/bench-scan-workers.py` builds it, runs an untimed warm-up and
rotating rounds under /usr/bin/time, and samples whole-machine CPU. It
prints the median table with deltas against the largest worker count:
scan time, CPU time, and the scan's share of all cores.
Whole-drive scans on an 18-core Apple silicon Mac (medians of three) took
209 s and 433 CPU-seconds with 4 workers, 133 s and 580 with 8, and 137 s
and 1,314 with 18. The tooltip said more than Balanced finishes "only about
20% sooner for about twice the CPU", which those runs contradict: 8 is a
third faster than 4, and 18 is no faster than 8 at over twice its CPU.
Other platforms keep the shape without numbers, since it was not measured
there.
The preset control added a second row to the top bar and a stacked-button
popup that marked the choice with the accent outline, unlike every other
menu in the app. It is now one framed control after Depth: a four-bar
signal gauge whose tooltip names the preset, its worker count and the
cost of going above Balanced (about 20% sooner for about twice the CPU,
with the fans at full speed on macOS).
The menu is built like the sibling menu: a caption header with the CPU
count, name, share-of-CPUs bar and worker count per row, the current
preset in bold, and the arrow keys, Enter and Escape. A preset that would
run no more workers than the one below it on this machine is shown but
disabled, and the arrows step over it. Labels say "workers" throughout.
With the settings back on one line, a long trail could clip the current
crumb's menu chevron. The trail now packs to its end, so it gives up its
start instead.
Right-clicking a tile in the treemap selects it and shows it in Finder,
File Explorer or the file manager, the same reveal `o` already does.
The platform work is GPUI's reveal_path, which runs detached on every
system. On macOS a ctrl-click arrives as a right-click, so it reveals
too; cmd-click still marks.
Elevated scans of a whole NTFS drive read the master file table in large parallel reads instead of walking directories; any failure falls back to the walk. The walk also allocates once per entry, tallies progress per directory and folds hardlink de-dup into the parallel aggregate pass.
The README has always said the mouse's side buttons retrace the visited
directories, and on_mouse_down had the two MouseButton::Navigate arms for
it, but nothing ever delivered buttons 8 and 9: the mosaic registered
listeners per button, for Left and Middle only. The arms were dead code.
Replaced the two registrations with on_any_mouse_down, so every button
reaches on_mouse_down and the Navigate arms work. One listener rather
than four, and the per-button form would have needed a new registration
for each button the platform names.
Guarded the arms on Screen::Explore, matching the alt-arrow path: on the
review screen the marked list is not somewhere history should move.
The help screen and the hover card on `<` and `>` named only the keys,
so the in-app bindings were narrower than the README's. Both now mention
the side buttons.