Spekter
Spekter is a GUI for diffing files and recursive directory trees. It tries to feel instant: tabs open immediately, file content appears at once, and the diff colouring fills in progressively in the background instead of blocking the view.
Why «instant»
The motivation is simple. Visual diff tools like Meld are wonderful, but on large directory trees they can spend several seconds churning before anything appears. Spekter is built around the opposite ordering: show what you already have, then keep computing in the background. Opening a comparison of a 50 000-file tree is not really different from a 10-file tree: the window appears, the tree fills in, and you can start clicking before the recursive hash check has finished.
Three small choices make this work: file content is read and rendered before any colour-coding is computed, the diff algorithm (imara-diff’s histogram variant) runs on a worker thread, and a filesystem watcher picks up external changes without you having to reopen the comparison.
The choice of imara-diff matters here. It’s one of the fastest diff libraries
in the Rust ecosystem: its histogram algorithm runs 10–100 % faster than
the classic Myers algorithm across a wide range of workloads, and on complex diffs
the more commonly used similar crate falls so far behind that the
comparison charts on imara-diff’s
crates.io page have to use a
logarithmic scale. The benchmarks there are run against real repositories (Linux
kernel, Rust compiler, VSCode, the Helix editor), so the numbers reflect actual
diffing work rather than toy inputs.
Beyond a Meld lookalike
The basics are familiar: side-by-side and unified views, synchronized scrolling, character-level inline highlights, tabs, Bezier gutter connectors between hunks. A few features came out of practical use:
- Structural slider adjustment. When an inserted block in a JSON array would otherwise land mid-object, Spekter nudges the hunk boundary to the nearest structural seam so the inserted object is marked as one unit rather than split across two.
- JSON order detection. Arrays and objects that contain the same items in different order are flagged as such, instead of being shown as a wall of red and green.
- CRLF normalization. Line-ending mismatches don’t fill the diff with false positives.
- Binary file handling. Non-text files report identical or differ with file sizes, rather than trying to render garbled bytes.
- Smart ignore. Skips
.git,.idea, swap files, backups and other usual noise by default.
Terminal mode for headless environments
Spekter ships a second binary, spekter-nw, that does the same diff work
without opening a window. Same comparison logic, same colour-coded output, but
rendered to your terminal instead. Useful over SSH, in a remote CI shell, or just
when you’d like to pipe a diff into less.
spekter-nw /path/to/old /path/to/new
Both binaries share the diff core, so a side-by-side comparison in the GUI and a
quick spekter-nw on the command line will agree about what differs.
Get Spekter
- Snap (Ubuntu/Debian):
snapcraft.io/spekter
(
sudo snap install spekter) - crates.io:
crates.io/crates/spekter
(
cargo install spekter) - Source: gitlab.com/hallyhaa/spekter