Sebastian Sylvan
sebastiansylvan.com · Personal blog · on HN since 2013
Sebastian Sylvan, a programmer, writes about hash tables, garbage collection, language design and performance of high-level languages.
What HN saysHN links it mostly for the Robin Hood hashing posts, which commenters recommend as a simple, cache-friendly scheme, and for his future-coding essay.
42HN people shared it
14linked it in comments
32stories submitted
488story points
4 months agolast shared
2013people per year2026
Most-shared posts
- 1Robin Hood Hashing should be the default hash table implementation (2013)9 people · 224 points · first shared 2016 · 53 comments on HN
- 2Garbage collection thoughts4 people · 63 points · first shared 2013 · 54 comments on HN
- 3Why (most) High Level Languages Are Slow4 people · 8 points · first shared 2017 · 1 comments on HN
- 4The Perils of Future-Coding4 people · 5 points · first shared 2017 · discussion on HN
- 5Robin Hood Hashing should be your default Hash Table implementation2 people · 23 points · first shared 2013 · 1 comments on HN
- 6Brackets are awesome, don't use them2 people · 8 points · first shared 2024 · 4 comments on HN
- 7Language Design Deal Breakers2 people · 4 points · first shared 2013 · discussion on HN
- 8Doing Garbage Collection Without Requiring Uniform Representation2 people · 4 points · first shared 2016 · discussion on HN
- 9Naming Convention for Matrix Math2 people · 3 points · first shared 2017 · 1 comments on HN
- 10More on robin hood hashing 22 people · first shared 2016
- 11Flags Are a Code Smell (2014)1 people · 61 points · first shared 2020 · 102 comments on HN
- 12Why (most) High Level Languages Are Slow1 people · 34 points · first shared 2015 · 2 comments on HN
- 13Two Performance Walls Approaching (2009)1 people · 31 points · first shared 2015 · 8 comments on HN
- 14The Perils of Future-Coding1 people · 10 points · first shared 2013 · 1 comments on HN
- 15On GC in Games1 people · 2 points · first shared 2014 · discussion on HN
What HN people wrote when they linked it
xedarius · 2016-09-01
He also wrote a follow up article addressing performance issues surrounding probe size increasing when erasing elements.
http://www.sebastiansylvan.com/post/more-on-robin-hood-hashing-2/
markpapadakis · 2016-08-29
I recommend Robin Hood open addressing scheme. It's particularly trivial to implement, and because it relies on linear probing, so it's memory-cache friendly.
See more here: http://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-…
Jeff Preshing has written many interesting blog posts about the subject. For example, see his blog post on Leapfrog Probing( http://preshing.com/20160314/leapfrog-probing/ )
cd_cd · 2017-02-09
Links would be good. And on that...
Could you provide a link to heavy numerical operations - btw, ones that use native libraries don't count cause it ain't the C# implementation doing the work? As I've said there are some routines where C# performs fine but for heavy-weight modelling requiring intense arithmetic matrix/vector operations it is just too slow. What's more the benchmark for a single run does not always scale to many. The overhead becomes compounded when you're doing the same operation over and over again due to GC and cache misses.
http://www.sebastiansylvan.com/post/why-most-high-level-languages-are-…
I love C#, I think it is a great language but it just doesn't belong at the level where I NEED to code at.
https://msdn.microsoft.com/en-us/library/ms973852.aspx
C is a pain in the ass to do the things that C# is good at. If it works for you across the board then fine but I would stop assuming everyone else is an idiot.
ericelliott · 2014-11-01
Google "classical inheritance harmful" and you'll find articles with plenty of code examples. The point of my article was not to bog the reader down in implementation details, but to communicate high-level concepts in rant-style prose. ;)
Here's a bit of code, ranting against the same problems, but coming up with different solutions:
http://berniesumption.com/software/inheritance-is-evil-and-must-be-des…
Here's a nice quote:
> I once attended a Java user group meeting where James Gosling (Java's inventor) was the featured speaker. During the memorable Q&A session, someone asked him: "If you could do Java over again, what would you change?" "I'd leave out classes," he replied. After the laughter died down, he explained that the real problem wasn't classes per se, but rather implementation inheritance (the extends relationship). Interface inheritance (the implements relationship) is preferable. You should avoid implementation inheritance whenever possible.
Link (with code samples):
http://www.javaworld.com/article/2073649/core-java/why-extends-is-evil…
More ranting:
http://sebastiansylvan.com/2010/12/03/implementation-inheritance-consi…
Fairly decent list of rants, with some pointed quotes from software development luminaries:
http://harmful.cat-v.org/software/OO_programming/
As for the IGG campaign, yes, I'm selling something. I make a living writing software, and teaching other developers how to write software better.
That has nothing to do…
dogwalker5000 · 2026-06-29
> What's the cost, probability and trade off between those possibilities?
I read an old article that compared the various scenarios.
https://www.sebastiansylvan.com/post/the-perils-of-future-coding/
TL;DR - it sides with YAGNI
GuiA · 2019-11-07
Here is a blog post applying a similar idea to matrix math:
https://www.sebastiansylvan.com/post/matrix_naming_convention/
nemo846 · 2018-10-17
> generalized and future proof
Reminds me of a blog post I read,
https://www.sebastiansylvan.com/post/the-perils-of-future-coding/
At what point does it become over-engineering?
igouy · 2017-02-27
> or you would be comparing apples to oranges
Do the other programs use that same hash table algorithm?
http://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-…
odabaxok · 2016-11-25
Some resources which were on HN before about Robin-Hood hashing:
About Robin-Hood hashing:
http://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-…
Rust's implementation of HashMap: http://cglab.ca/~abeinges/blah/robinhood-part-1/
lorantt · 2016-09-30
I think people here seem to implicitly assume linked buckets, those are bad on modern architectures for several reasons.
Look at (Hopscotch,) Robin Hood or Cuckoo Hashing for hashing with linear probing, high fill factor (~0.9) and _amortized_ O(1). I've seen a paper somewhere that proved Robin Hood worst-case O(log log n) afair.
http://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-…
https://en.m.wikipedia.org/wiki/Hopscotch_hashing
You can make open probing performantly concurrent with 2 bytes of memory overhead per key/value too:
http://preshing.com/20160314/leapfrog-probing/
catnaroek · 2016-07-28
If you take the view that object references are options, then it's plain unsound to manipulate object references as though they weren't options! `NullPointerException` is just a dynamic plug on a static type safety hole.
This blog post (I'm not the author) explains the issue (item 3) very well: http://www.sebastiansylvan.com/post/language-design-deal-breakers/
daredevildave · 2016-06-19
They are still very much required for games/real-time rendering :-)
I hadn't heard ptex before, it's interesting stuff. Sounds like the reason it isn't in general usage for realtime stuff is the memory overhead: http://sebastiansylvan.com/post/casting-a-critical-eye-on-gpu-ptex/
keyP · 2019-12-18
I've not had any particular reason to specifically use this but I found Robin Hood Hashing to be quite an interesting concept. It improves performance by essentially reducing the distance from the key to its matching key-value pair.
Advantages listed from [3]:
- The number and variance of look-ups are reduced
- Searches can be ended early, since 'hits' are found much quicker
- The flat array structure eliminates need for linked lists or pointers: reduces misses and overhead
- Even finding non-existent elements is fast
- This method approaches O(1), meaning the most efficient search
[1]Part 1: https://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your…
[2]Part 2 (slight update based on suggestions in part 1's comment): https://www.sebastiansylvan.com/post/more-on-robin-hood-hashing-2/
[3]https://study.com/academy/lesson/robin-hood-hashing-concepts-algorithm…
dragontamer · 2019-10-11
> Issues with open addressing are issues like clustering if linear probing is used.
Robin Hood hashing more or less solves that problem.
> When we delete keys, we have to leave "tombstone" entries in their place, so that the linear probing can continue past them to find other items.
Actually no. Even ignoring Robin Hood Hashing, you just swap a later element into place.
idx = hash(value);
delete(array[idx]);
for(int i=idx+1; array[i] != empty; i = (i+1) % TABLE_SIZE){
if(hash(array[i].value) <= idx){
array[idx] = array[i];
idx = i; // Repeat for the new location
}
}
I just typed the above in like 2 minutes, so there's probably a bug. But its probably "correct enough" that you can get the concept. There's no tombstones needed for linear probing (and only linear probing).
Conceptually, you can see that array[i] is simply being "re-hashed" into the hash table. Donald Knuth in "The Art of Computer Programming" proves that the above procedure (well... the correct bug-free version at least) is equivalent to clearing out the hash table and rehashing all elements. Except of course, the above procedure is way faster.
--------
Robin Hood hashing solves the problem in a different way. See this other guy's blog post for details: https://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your…