miniblog.

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.
PhotoPhoto
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.
PhotoPhoto
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).
PhotoPhoto
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.
Photo
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.
PhotoPhotoPhoto
Neat GitHub feature I haven't seen before: if the contributing guide has changed since your last pull request, it tells you!
Photo
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 }
I wrote a non-trivial graph algorithm and it worked first time! I was suspicious until I tried it on a three node graph and was kinda comforted to learn it still had bugs.
I'm not convinced that offering the staging area is a good default for git. It's an abstraction that newcomers have to learn before their first commit. Subversion style "commit every tracked file" isn't as pretty (`git add` is general) but it's the common case.
Showing 1,186-1,200 of 7,652 posts