$ show colinvkim/Radix
Radix is a native macOS disk space analysis application built with SwiftUI, Swift concurrency, and deep integration with macOS filesystem APIs (APFS clones, FSEvents, getattrlistbulk). The core scanning engine uses actor-based parallelism with atomic directory summarization, incremental rescanning via FSEvent history, and cancellation-aware sort and layout operations. The app features interactive sunburst and treemap visualizations with viewport pan/zoom, a searchable file browser with sorted tables, discard pile for staged trash operations, cross-snapshot comparison showing file changes over time, and export/import of scan snapshots in a versioned compressed archive format (.radixscan). Architecture follows a clean separation of Models, Services, ViewModels, and Features, with heavy use of dependency injection closures for testability. The codebase includes extensive unit, integration, and benchmark tests (Swift Testing) covering correctness, performance, and concurrency safety. It demonstrates high craftsmanship in file tree storage (compact arena with logical scopes), cancellation patterns, APFS storage accounting, and interactive chart geometry.
The LLM identified 5 files worth highlighting for reuse:
Provides a mechanism to offload deallocation of large backing stores (e.g., bitmap buffers) to a serial background queue after the main actor publishes results. Prevents UI jank caused by synchronous cleanup of heavy resources. The pattern is isolated and can be extracted to any SwiftUI or AppKit app that needs to defer expensive release operations.
Implements a merge sort variant that works in fixed-size chunks and checks a cancellation closure between each run. This allows long-running sorts (e.g., sorting millions of file nodes) to be cancelled responsively without blocking the UI thread. The algorithm is self-contained, parameterized by comparator and cancellation check, and can be reused in any project requiring cancellable sorting.
Generic coordinator that manages asynchronous layout requests. It automatically cancels stale requests when a new request arrives, deduplicates concurrent requests to avoid redundant work, and ensures results are only applied to the latest request generation. This pattern is directly applicable to any view that performs expensive async recomputation (e.g., chart layouts, search result rendering) and is designed to be reused with minimal adaptation.
Accumulates shared allocation owners (hard links and APFS clones) by rebuilding ancestor chains and rebalancing claimed allocations so that each physical block is attributed to exactly one file. Demonstrates deep knowledge of macOS filesystem internals (clone IDs, link counts) and provides accurate storage accounting that is critical for disk usage tools. The accumulator pattern is self-contained and could be adapted for other filesystem deduplication scenarios.
Core tree data structure using flat arrays with UInt32 indices for parent/child relationships, enabling cache-friendly traversal and minimal memory overhead. Supports immutable logical scopes that create lightweight subtree views into the same backing store without copying nodes. Includes methods for subtree removal, size replacement, and precomputed aggregate statistics. This design is highly reusable in any application that needs efficient in-memory tree storage with copy-on-write semantics.