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.
miniblog.
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!
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!
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.
Running a CPU emulator the "modern" way, with Kubernetes cluster of microservices for each opcode!
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.
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.
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/
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).
Interactive Sokoban, the 2D logic puzzle, on a non-Euclidean surface:
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-tutorial
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.
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.
Neat GitHub feature I haven't seen before: if the contributing guide has changed since your last pull request, it tells you!
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 }
Showing 166-180 of 345 posts












