Tristan Hume
thume.ca · Personal blog · on HN since 2012
Tristan Hume, a programmer, writes about performance, latency measurement, language design comparisons, and unusual projects like telefork.
What HN saysCommenters cite it for the telefork post and the tree diff article, which another commenter says matches an approach they used.
93HN people shared it
49linked it in comments
88stories submitted
5.4Kstory points
10 months agolast shared
2012people per year2026
Most-shared posts
- 1Measuring keyboard-to-photon latency with a light sensor10 people · 149 points · first shared 2020 · 46 comments on HN
- 2Models of Generics and Metaprogramming: Go, Rust, Swift, D and More10 people · 98 points · first shared 2019 · 6 comments on HN
- 3Designing a Tree Diff Algorithm Using Dynamic Programming and A*9 people · 239 points · first shared 2017 · 21 comments on HN
- 4My Tungsten Cube (2019)7 people · 298 points · first shared 2019 · 330 comments on HN
- 5On some LCD monitors this will cause them to emit a tone (epilepsy warning)7 people · 149 points · first shared 2015 · 66 comments on HN
- 6Teleforking a Process onto a Different Computer5 people · 792 points · first shared 2020 · 132 comments on HN
- 7Production Twitter on One Machine? 100Gbps NICs and NVMe Are Fast5 people · 19 points · first shared 2023 · 2 comments on HN
- 8My tier list of interesting YouTube channels5 people · 16 points · first shared 2020 · discussion on HN
- 9Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml4 people · 784 points · first shared 2019 · 370 comments on HN
- 10Fragile narrow laggy asynchronous mismatched pipes kill productivity4 people · 266 points · first shared 2020 · 86 comments on HN
- 11Magic PNG Thumbnails4 people · 114 points · first shared 2012 · 41 comments on HN
- 12My Text Editor Journey: Vim, Spacemacs, Atom and Sublime Text4 people · 69 points · first shared 2017 · 88 comments on HN
- 13Writing a Compiler in Rust4 people · 5 points · first shared 2019 · discussion on HN
- 14Implicit In-order Forests: Zooming a billion trace events at 60fps3 people · 193 points · first shared 2021 · 24 comments on HN
- 15Shenanigans With Hash Tables3 people · 145 points · first shared 2019 · 23 comments on HN
What HN people wrote when they linked it
dapperdrake · 2026-01-18
Finally a tool that accepts the greatness of sh, rsh, and ssh.
For fun look at telefork(2)
https://thume.ca/2020/04/18/telefork-forking-a-process-onto-a-differen…
musicale · 2024-10-12
This is from 2015, but emacs still has higher typing latency than vim in 2024.
https://pavelfatin.com/typing-with-pleasure/
If you have better numbers and comparisons for emacs keypress-to-pixel latency, etc. I'd be interested.
Note classic vi started up faster than vim.
Device makes little to no difference: Raspberry Pi 5, MacBook Pro M1, ThinkPad P1, etc. - emacs is clunky on all of them. I like emacs and it's my daily driver. But it isn't fast.
see also:
"Computer latency: 1997-2017" https://danluu.com/input-lag/
"Measuring keyboard-to-photon latency with a light sensor" https://thume.ca/2020/05/20/making-a-latency-tester/
trishume · 2022-09-07
This is a really cool example of tree diffing via path finding. I noticed that this was the approach I used when I did tree diffing, and sure enough looks like this was inspired by autochrome which was inspired by my post (https://thume.ca/2017/06/17/tree-diffing/).
I'm curious exactly why A* failed here. It worked great for me, as long as you design a good heuristic. I imagine it might have been complicated to design a good heuristic with an expanded move set. I see autochrome had to abandon A* and has an explanation of why, but that explanation shouldn't apply to difftastic I think.
NobodyNada · 2020-09-11
> And I was thinking why did they make Swift for low level usage if they were going to use Rust.
Swift is great for application programming, but for low-level performance-critical systems programming it’s currently a huge pain in the rear. Swift’s philosophy is basically “give everything a Python-like level of dynamism, and then heavily inline/optimize out when statically possible.” For instance:
- Swift’s memory management is based on reference counting. It’s usually convenient and efficient (and lets you do cool things like copy-on-write), but when you know more about your object lifetimes than the compiler, the unnecessary retain/release traffic gets really annoying and is not easy to avoid.
- Swift’s generics are dynamic by default, which involves wrapping up every object into a possibly-heap-allocated container and using dynamic dispatch for everything. Usually the compiler will inline/specialize generics, but there’s no guarantee, especially when calling generics across module boundaries (due to ABI stability restrictions). Rust/C++ exclusively uses compile-time template instantiation, which is a little less flexible and doesn’t guarantee ABI stability but it always guarantees unimpaired performance. See [0] for a more detailed comparison.
- No stack-allocated arrays in Swift; all collections are reference-counted and stored on the heap.
- Still no async/await (or any real concurrency model at all) in Swift; it’s planned to be available in the next year or two.…
yunyu · 2020-05-31
Hey HN, this is a side project that we made after realizing that a solid chunk of the time and code spent doing full-stack development was spent writing and debugging RPC layers - REST, GraphQL, GRPC, you name it.
The fact that the frontend and the backend are separate services leads to a bunch of cruft (https://thume.ca/2020/05/17/pipes-kill-productivity/ is a perfect description) and security holes, so we had the idea of merging them. It turns out that Phoenix LiveView already did server-side execution with changes streamed over WebSockets, but we weren't the biggest fans of having to learn an entirely new ecosystem and paradigm. So, we built a framework that allows (at the moment, admittedly simple) vanilla React apps to run on Node.js, with DOM updates being streamed to the client. That way, we can delete the RPC layer and greatly reduce development complexity and total code.
Would love to hear your thoughts!
sadamznintern · 2018-08-11
What tech interns do at trading companies, especially JS, always amazes me. Not because of the complexity of the problem domain but rather the rigor of the solution.
Something like Tristan Hume's famous blog post [0] on Tree Diffing would be unthinkable at Amazon, or most likely even Google or FB. If it's for internal use, they'd just slap together whatever works and looks nice, test the crap out of it and launch (part 2 optional). Nobody would want to spend weeks minimizing the white space like this, especially over 5 weeks.
I know multiple people who have interned at Trading companies - all making more than $9k a month - working on optimizing React rendering for tables. They have solutions that are amazing and wonderful because they are superior engineers and computer scientists than mere mortals like me, but for the problem space it seems pretty ridiculous.
I know people who have done crazy stuff that has gone into production during their Google, Facebook, or even lesser companies like Amazon internships but were compensated a fraction ($6k a month at Amazon vs. $10k a month at JS). I guess this is the dollar value difference of prestige.
[0]: http://thume.ca/2017/06/17/tree-diffing/
gjm11 · 2025-12-28
> no one actually wants to buy a tungsten cube
Apparently some people do and don't even regret the purchase: https://thume.ca/2019/03/03/my-tungsten-cube/
JackSlateur · 2025-10-14
It is an issue to mistake scalability with resiliency
Yes, we can run twitter on a single server (https://thume.ca/2023/01/02/one-machine-twitter/) No, we do not want to run twitter on a single server
int_19h · 2025-06-26
It would be more accurate to say that idiomatic Rust encourages doing things which are slow to compile: lots of small generic functions everywhere. And the most effective way to speed this up is to avoid monomorphization by using RTTI to provide a single generic compiled implementation that can be reused for different types, like what Swift does when generics across the module boundary. But this is less efficient at runtime because of all the runtime checks and computations that now need to be done to deal with objects of different sizes etc, many direct or even inlined calls now become virtual etc.
Here's a somewhat dated but still good overview of various approaches to generics in different languages including C++, Rust, Swift, and Zig and their tradeoffs: https://thume.ca/2019/07/14/a-tour-of-metaprogramming-models-for-gener…
karmakaze · 2024-12-01
Specifically for the Expressiveness of different languages (including static- or dynamic-ally typed) I use this post[0] as a counterexample to any dogma.
[0] http://thume.ca/2019/04/29/comparing-compilers-in-rust-haskell-c-and-p…
antimatter15 · 2024-07-23
Maybe look into implicit in-order forests (https://thume.ca/2021/03/14/iforests/)
_nalply · 2024-06-21
Always keep a tungsten cube in your pocket!
https://thume.ca/2019/03/03/my-tungsten-cube/
Izkata · 2023-10-07
CRIU can apparently do that with whole processes: https://criu.org/Main_Page
Found a link to it from telefork: https://thume.ca/2020/04/18/telefork-forking-a-process-onto-a-differen…
maattdd · 2023-10-06
There is this comparison of student projects in different languages https://thume.ca/2019/04/29/comparing-compilers-in-rust-haskell-c-and-…
aumerle2 · 2023-04-16
kitty is much better than the rest on latency, see hardware based measurements
https://thume.ca/2020/05/20/making-a-latency-tester/
showing kitty has the same latency as terminal.app on macos.
igammarays · 2023-01-11
There used to be FTP services in the 90s that served millions of users from a single machine. (Sorry can't find the reference right now).
Even production Twitter in 2023 is estimated to be able to fit on a very beefy machine: https://thume.ca/2023/01/02/one-machine-twitter/
Of course we would use a CDN in 2023, which is cheating, but from a business point of view it is juse one machine you manage.
pgayed · 2022-11-14
> Now that there's no product left to harm with outdated metrics: https://thume.ca/2022/05/15/latency-testing-streaming/ was about Mighty. They were nice to me, and had decent tech, but I did that testing cuz my intuition was that it would be a worse experience unless your laptop was very RAM-starved.[0]
[0] https://twitter.com/trishume/status/1591995028842418176?t=Gzj3WhJ0HPL6…
metadat · 2022-11-09
A hairy yet stylish keyboard.
https://thume.ca/assets/postassets/travelwork/case-open.jpeg
Didn't Eminem sing a song about the affliction of hairy palms?
kleene_op · 2021-08-18
Not necessarily.
If you know the method used by Apple to scale down flagged images before they are sent for review, you can make it so the scaled down version of the image shows a different, potentially misleading one instead:
https://thume.ca/projects/2012/11/14/magic-png-files/
At the end of the day:
- You can trick the user into saving an innocent looking image
- You can trick Apple NN hashing function with a purposely generated hash
- You can trick the reviewer with an explicit thumbnail
There is no limit to how devilish one can be.
diggan · 2021-08-13
Similar idea, but instead of probing the keyboard keys, it has a mechanical arm + takes a high-framerate video of the keyboard + screen to measure the latency. Not automatic like yours would, but probably wouldn't be hard to use different software (they seem to be using a game, you could write an application that instead flashes bright white/$color) and then process the video to get the start/end time of the measures.
https://www.rtings.com/keyboard/tests/latency
Edit: This seems even closer to what you were suggesting: https://thume.ca/2020/05/20/making-a-latency-tester/
0b01 · 2021-07-19
You are correct. It is indeed possible to use dynamic programming. For more info check out [0]. OP’s project probably takes too long on nontrivial merges in its current state.
[0] https://thume.ca/2017/06/17/tree-diffing/
read_if_gay_ · 2021-05-23
This is a good one:
https://thume.ca/2020/07/19/my-youtube-tier-list/
mkeeter · 2021-03-04
It's self-reported by the logging system after glfwShowWindow() returns for the first time, so probably not 100% accurate, but reasonably close.
A truly fancy system would be something like Tristan Hume's keyboard-to-photon latency system:
https://thume.ca/2020/05/20/making-a-latency-tester/
omgwtfbyobbq · 2021-02-27
It seems like a real 6+% has been possible over the past half century.
https://thume.ca/indexView/
Granted, it could be that the SP500 or the US over the past half century is not representative of equities over a longer time period, like a century, but in that case I don't know what is.
jchw · 2020-10-29
Whether it works or not depends on how many samples are used to downscale. Amusingly, this attack was used for bait-and-switch and “click here to [x]” gimmicks on some websites, especially 4chan, and you can find examples tuned primarily for typical thumbnail generators (which, probably for performance reasons, tend to only sample a small number of pixels.)
https://thume.ca/projects/2012/11/14/magic-png-files/
hkmaxpro · 2020-09-18
Apple Terminal and kitty both have less latency than Alacritty. Alacritty being “the fastest” may just be a marketing gimmick.
https://thume.ca/2020/05/20/making-a-latency-tester/
komali2 · 2020-09-06
https://thume.ca/2019/03/03/my-tungsten-cube/
Looks like it's just a heavy cube to use as a fidgit toy? I wanna play with it now too lol.
Edit: I don't know how to link directly to a single amazon review but holy shit read the one from Richard , it should be the first https://www.amazon.com/Tungsten-Cube-1-5-One-Kilo/dp/B00XZBIJLS/
Myrmornis · 2020-06-29
Looks like this post is relevant: https://thume.ca/2020/05/20/making-a-latency-tester/
Perseids · 2020-05-30
True, but the alternative to C++ with that reasoning is Rust or Go (depending on your liking), not Ruby. And with both of these you can step around a lot of deployment issues, because a single server can be sufficient for quite high loads. Avoid distributed systems as much as you can: https://thume.ca/2020/05/17/pipes-kill-productivity/
snazz · 2020-03-20
If you put serious effort into your class projects outside of what is required (https://thume.ca/ray-tracer-site/), you can certainly put that in your portfolio (that project is absolutely crazy). That said, I agree with you that more students should take "software engineering" degrees if they have trouble building things outside of class, plus that universities should make it clearer that a CS degree != a job offer from Google.