Spent some time today trying to replace difftastic's implementation of Dijkstra's algorithm with A* search.
I got a working implementation that passes tests:
https://github.com/Wilfred/difftastic/commit/9a271169f68cdb678efe2035f5a4e45daeb6533d but sadly it's no faster. My slowest files still take 1.5 seconds with similar memory.
Wilfred Hughes
How do you tell if a computer game is being played by a human or a computer?
Trackmania allows you to replay every keystroke. Enthusiasts have reverse engineered the game and measured what the fastest possible inputs are possible by hand!
Wilfred Hughes
It's wonderfully easy to switch out the allocator in Rust:
https://doc.rust-lang.org/edition-guide/rust-next/no-jemalloc.html
Sadly it didn't help difftastic performance despite doing a lot of allocation, but it's really easy to try it!
Wilfred Hughes
Difftastic update: It now prefers matching nodes of a similar nesting level. This seems to help when there are multiple possible minimal diffs.
Left is before, right is after. I think it's an improvement overall, but golly the output can become inscrutable sometimes.
Wilfred Hughes
Running a CPU emulator the "modern" way, with Kubernetes cluster of microservices for each opcode!
Wilfred Hughes
Efficiently generating random numbers in an interval 0-N
https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/
The article demonstrates rejection sampling and bit masking. I've hit this problem a few times in property-based test frameworks, so it's nice to see solution techniques.
Wilfred Hughes
It's amazingly awkward to print a syntactic diff correctly. Even the lines before and after the changes may not line up, if whitespace has changed!
Difftastic now inserts blank lines to help things line up. I'm reasonably happy with the result here.
Wilfred Hughes
Haskell Wingman is a fun project that provides hole-based refinement to any editor that speaks LSP!
It's a great example of how to describe complex features in terms of user benefit too.
https://haskellwingman.dev/Wilfred Hughes
I've been playing with 'sliders' in difftastic, the classic diff problem where you highlight an adjacent value that is correct but weird.
I've taught difftastic to penalise sequences across newlines. This largely works, but it hurts perf (another degree of freedom to solve).
Wilfred Hughes
Interactive Sokoban, the 2D logic puzzle, on a non-Euclidean surface:
Wilfred Hughes
Snorkel is a project that encourages you to build heuristic functions to train a ML model on. It's a clever alternative to manually labelling data.
https://www.snorkel.org/use-cases/01-spam-tutorialWilfred Hughes
Sadly `git difftool` invokes your tool once per file. This makes it hard to print whitespace between files.
I'm experimenting with adding an extra newline at the end of output, but it feels a bit untidy for the single file case.
Wilfred Hughes
Difftastic update: I've rewritten the tree diffing logic to use Dijkstra's algorithm similar to Autochrome.
It works amazingly well! Note how it recognises both parent and children unchanged nodes in the lisp example. You can even see me refactoring Rust to use if-let.
Wilfred Hughes
Neat GitHub feature I haven't seen before: if the contributing guide has changed since your last pull request, it tells you!
Wilfred Hughes
Plain data in Rust can be surprisingly verbose.
I thought I wanted:
enum Action { Changed, Unchanged }
but it turned out I wanted this instead:
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
enum Action { Changed, Unchanged }
Wilfred Hughes