Robin Hood hashing, and a remarkable bug in Rust where building one hash map from another can have quadratic performance!
https://accidentallyquadratic.tumblr.com/post/153545455987/rust-hash-iteration-reinsertion
miniblog.
@janriemer@mastodon.technology @friend Not spam at all!
Thanks, I'd not seen that, and it looks really well suited to my needs :)
@friend @janriemer@mastodon.technology Sounds like a good choice! I recently found this interesting benchmark table which shows Blake as a great cryptographic hash: http://cyan4973.github.io/xxHash/
(FWIW difftastic uses rustc-hash for its hashing needs.)
Git repositories have the lovely properties that deletes aren't propagated. Shared/cloud storage sync deletes across devices.
Accidentally deleting content in a local git repo, and even pushing it, is a safe operation.
Fun fact: for simple text diffs, difftastic is now constrained by terminal output performance!
I halved instruction counts for diffing a 300KLOC text file against "" and I only went from 8.2 seconds to 6.5 seconds.
Most of the code I write is in a garbage collected language.
I'm often surprised how much extra performance I can get when I can control allocations. I saved ~10% runtime in difftastic by moving to a zero-allocation colour library (owo_colours)!
My Rust rule of thumb: if there are no lifetimes in your return type, you probably don't need to specify the lifetimes in your arguments.
(I know clippy will point out simple cases of unnecessary lifetimes, but plenty other cases occur IME.)
What's your favourite file checksum when you don't need cryptographic strength?
md5sum is convenient (it's installed on most systems), but it was originally intended to be secure. I just want a fast content check.
(Or is sha256sum sufficiently optimised that it doesn't matter?)
tree-sitter is wonderful, but it struggles if you try to parse its own output files.
In fairness, parsing a multi-megabyte C file is hard. The C# parser has a parser.c file totalling 18MiB!
Difftastic 0.19 is out! In this release:
* Vastly improved syntax highlighting!
* Smart fallback to textual diffing for extremely large files
* Many smaller bugfixes:
rustc is the only self-hosted compiler I've seen that uses external packages in the target language. Are there others?
I refactored some Rust string splitting logic:
old: &[&str] -> Vec<String>
new: &[&str] -> Vec<&str>
It's a little faster, but it's an interesting type signature. You can figure out more of how the new one works! It must be slicing into the input string.
One underrated advantage of ORMs: it's significantly harder to write code vulnerable to SQL injection.
Bytecode interpreters vs tree walkers, and beating GNU Awk performance in GoAWK: https://benhoyt.com/writings/goawk-compiler-vm/
Ooh, today I learnt that terminals support italics! Difftastic now uses italics for comments.
Bold/italics are great because they're still visible even when you're showing text in green or red. They compose nicely :)
tagref is a cute tool where you write `// see [tag:foo] and it ensures that `[tag:foo]` actually exists somewhere in your codebase.
https://github.com/stepchowfun/tagref
"Minus 100 points", an article on deciding how to add features C#, remains one of the best introduction to PL design principles I've seen: https://docs.microsoft.com/en-us/archive/blogs/ericgu/minus-100-points
(Design is hard, combinatorial complexity grows easily, saying "no" needs to be a default.)
Measuring Go program (GoAWK) performance from 1.2 to 1.18: https://benhoyt.com/writings/go-version-performance/
The Go 1.3 runtime led to a 2x speedup in GoAWK, and performance wins have continued since. It's easy to see popular PLs as largely finished, but the wins here show there's still opportunities.
> try wrapping the expression in `summary::FileContent::Text`
This rust-analyzer feature amazed me. I'd changed an API from taking a &str to a Text(String) and it offered a quick fix to correct the call sites!
An incredible 2,200 commit series that organises headers in the Linux kernel and cuts incremental build times in half: https://lwn.net/ml/linux-kernel/YdIfz+LMewetSaEB@gmail.com/
Showing 321-340 of 384 posts