R
Russell Cohen
rcoh.me · Personal blog · on HN since 2013
Russell Cohen, a backend infrastructure engineer, writes about Rust, algorithms, data structures, and concurrency in Go and Java.
What HN saysHN links his posts on linked lists in safe Rust and linear-time median finding; one commenter calls the median post a deep rabbit hole.
25HN people shared it
11linked it in comments
41stories submitted
1.6Kstory points
4 months agolast shared
2013people per year2026
Most-shared posts
- 1Why writing a linked list in safe Rust is so damned hard7 people · 224 points · first shared 2018 · 191 comments on HN
- 2An Introduction to Cache-Oblivious Data Structures6 people · 226 points · first shared 2018 · 31 comments on HN
- 3My Favorite Algorithm: Linear Time Median Finding (2018)5 people · 379 points · first shared 2018 · 181 comments on HN
- 4Why you can have millions of goroutines but only thousands of Java threads5 people · 291 points · first shared 2018 · 151 comments on HN
- 5Thoughts on Rust, a few thousand lines in2 people · 233 points · first shared 2018 · 174 comments on HN
- 6Verifiable Voting: A Primer2 people · 74 points · first shared 2019 · 65 comments on HN
- 7Thoughts on Rust, a few thousand lines in2 people · 22 points · first shared 2018 · 2 comments on HN
- 8Sudo Science2 people · 4 points · first shared 2018 · discussion on HN
- 9An Analysis of Hash Map Implementations in Popular Languages2 people · 3 points · first shared 2018 · discussion on HN
- 10Postgres indexes under the hood1 people · 162 points · first shared 2018 · 23 comments on HN
- 11Reflections on two years of freelancing1 people · 4 points · first shared 2018 · discussion on HN
- 12Demystifying 2 Factor Auth1 people · 3 points · first shared 2018 · discussion on HN
- 13How to do a good code review1 people · 3 points · first shared 2019 · discussion on HN
- 14How Postgres unique constraints can hang your app1 people · 2 points · first shared 2018 · discussion on HN
- 15Resource Pools and Deadlock1 people · 2 points · first shared 2018 · discussion on HN
What HN people wrote when they linked it
rusbus · 2020-03-02
SEEKING WORK | Remote or Boston | https://rcoh.me | [email protected]
I do everything, but specialize in backend infrastructure.
- Rust, Python, Go, Scala, Java, Python, C/C++
I also do devopsy things (Ansible, Terraform, etc.)
I have a lot of experience running Kubernetes clusters and porting infrastructure to k8s.
raddan · 2026-07-09
The rabbit hole goes deep fast with this one!
https://rcoh.me/posts/linear-time-median-finding/
I vaguely recall learning a randomized (approximate) streaming median algorithm in grad school, but the details have left my brain…
johnisgood · 2026-01-20
Yes, you are looking for https://rcoh.me/posts/rust-linked-list-basically-impossible/.
gavinray · 2023-12-17
What?
I mean, there are specific sizes that will fit in the L-(N) cache.
And consequently, sizes that don't suffer from the false-sharing problem in concurrent scenarios due to this.
https://en.cppreference.com/w/cpp/thread/hardware_destructive_interfer…
There's an entire field of study devoted to cache-friendly/cache-oblivious data structures:
- https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/cc…
- https://rcoh.me/posts/cache-oblivious-datastructures/
fortran77 · 2022-11-05
I think the Rust people are de-emphasizing the importance of linked lists due to the glaring hole in the Rust language that makes it difficult to implement linked lists, and horribly awkward to do doubly-linked lists in safe Rust
(See https://rcoh.me/posts/rust-linked-list-basically-impossible/ )
To save face, the Rust astroturfers are now skipping around saying "Linked lists aren't important"
singron · 2019-12-06
This sounds like the method from the Rivest, 2006 paper: https://rcoh.me/posts/verifiable-voting-primer/#fn:triple
geophile · 2019-03-22
GC is only part of the issue. Value types allow much finer control over locality, something completely lacking in Java now. And without that, you give up a lot of performance.
For example: https://rcoh.me/posts/cache-oblivious-datastructures/
WoodenChair · 2019-01-27
Goroutines are not threads:
https://rcoh.me/posts/why-you-can-have-a-million-go-routines-but-only-…
amelius · 2018-12-23
Have you tried writing a doubly linked list?
https://rcoh.me/posts/rust-linked-list-basically-impossible/
jorangreef · 2013-10-15
If you are hashing fixed-size keys, then tabulation hashing is simple and fast with good theoretical properties:
http://en.wikipedia.org/wiki/Tabulation_hashing
http://rcoh.me/pyhash.pdf
lumost · 2020-10-03
First off, thank you for all of the work you've put into Rust! I think the challenge that you face is that if the problem is CS101 courses, then Rust will always be unfamiliar to the majority of practicing professionals.
Cyclic/recursive datastructures are common in web services, where one needs to model bidirectional relationships ( just think of friends on a social graph ). As well as several primitive datastructures such as the O(1) LRU cache.
Checking the Rust docs out, a dev who encounters this problem for the first time will eventually need
- "Reference Cycles Can Leak Memory" https://doc.rust-lang.org/book/ch15-06-reference-cycles.html
-- caveat: what if ownership is truly bidirectional?
- "unsafe" https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html
- 5 different primitive lists which don't tell you how to make a friends graph: https://rust-unofficial.github.io/too-many-lists/infinity-double-singl…
- Someone elses attempt: https://rcoh.me/posts/rust-linked-list-basically-impossible/
- Careful reading of the LinkedList implementation to see that unsafe is probably the best approach: https://doc.rust-lang.org/beta/src/alloc/collections/linked_list.rs.ht…
I'm a little biased on this front, when I first picked up Rust I chose to tackle an O(1) LRU cache as a quick learning exercise. I ended up beating my head against a wall for 20 hours. However on my current project I'm analyzing the wikipedia dataset ( another bidirectional structure…