Sean Barrett
nothings.org · Personal blog · on HN since 2008
Sean Barrett, game programmer and author of the single-file stb C libraries, writes on graphics, algorithms, and parsing.
What HN saysHN commenters point to it for the stb libraries, especially stb_ds containers in C, and for his critique of Judy arrays, whose added complexity they find not worth it.
90HN people shared it
50linked it in comments
49stories submitted
1.3Kstory points
3 months agolast shared
2008people per year2026
Most-shared posts
- 1A Performance Comparison of Judy to Hash Tables (2003)11 people · 2 points · first shared 2009 · discussion on HN
- 23D Software Rendering Technology of 1998's Thief: The Dark Project (2011)10 people · 356 points · first shared 2011 · 45 comments on HN
- 3Corners Don't Look Like That: Regarding Screenspace Ambient Occlusion (2012)9 people · 367 points · first shared 2012 · 43 comments on HN
- 4Homepage8 people · first shared 2011
- 5How the Stb_truetype Anti-Aliased Software Rasterizer v2 Works (2015)7 people · 18 points · first shared 2016 · discussion on HN
- 6Why the Web Sucks (You Just Don't Know It) by Sean Barrett5 people · 12 points · first shared 2008 · 2 comments on HN
- 7Minesweeper: Advanced Tactics (2005)4 people · 135 points · first shared 2013 · 50 comments on HN
- 8Some Strategies for Fast Lexical Analysis When Parsing Programming Languages4 people · 32 points · first shared 2018 · 4 comments on HN
- 9L-Systems Considered Harmful (2009)4 people · 2 points · first shared 2014 · discussion on HN
- 10Herringbone Wang Tiles3 people · 181 points · first shared 2014 · 10 comments on HN
- 11I Found Myself in the Game Industry (2013)3 people · 28 points · first shared 2018 · 2 comments on HN
- 12Herringbone Tiles3 people · 15 points · first shared 2020 · discussion on HN
- 13Iteration is Hard3 people · 14 points · first shared 2012 · discussion on HN
- 14Stretchy buffer3 people · first shared 2012
- 15The Compositing Tree (2014)2 people · 70 points · first shared 2016 · 2 comments on HN
What HN people wrote when they linked it
psykotic · 2011-08-07
You are insulted by the idea of programming puzzles in an interview situation. That's fair enough by me. But then you go on to say this:
> I also happen to hire and if the candidate does not have an open source project I give them a meaningful challenge (add value to the community) and tell them to create a github acct and share a link to the repo. At least by the end of the process they have something to walk away with
Could you be any more silly and condescending? Right back at you: Unless your nickname is a literal and accurate description of your programming abilities, I will take a bet of dollars to donuts that every programmer in my office has more raw coding acumen than you. But guess what? None of them has a GitHub account and that is unlikely to change. Neither do most of the other top-tier programmers I know. One of my coworkers has put out numerous public domain libraries (http://nothings.org), most of them developed on RAD's dime, but he'd probably be appalled to be considered a member of your "community".
I actually have an old, effectively defunct GitHub account that I continue paying $8/month for because I like what those guys are doing. The problem isn't GitHub. GitHub is great. The problem is you, and people like you.
Don't be a GitHub Douche.
marvinborner · 2026-02-10
Sean Barret's website: https://nothings.org/
(responsible for the famous single-file C libraries)
itay2805 · 2025-07-26
By far the best implementation for type-safe containers in C I found is stb_ds, it provides both a vector and a hashmap (including a string one).
https://nothings.org/stb_ds
flipgimble · 2023-11-19
If you value learning about the strengths and weaknesses of different algorithms then I recommend reading this counter-argument against one species of heavily extended L-Systems used for city road network generation: http://nothings.org/gamedev/l_systems.html
lifthrasiir · 2022-09-05
Even at that time the claim was heavily challenged [1], and I agree to Sean's conclusion: Judy array might be slightly faster for some applications but an added complexity is not worth it.
[1] https://nothings.org/computer/judy/ (2003)
kaesve · 2022-07-25
A 'trick' that I've grown fond of is for iterating over a circular list where the current and previous items form an edge, with a special case for the first edge, that is composed of the first and last items of the list (making it circular).
The 'normal' way to write a loop over this is something like:
for (let i = 0; i < ls.length; i++)
{
const j = i > 0 ? i - 1 : ls.length - 1;
...
}
A trick I got from sean barretts website (https://nothings.org/), is to use the for-loop initialization clause for the special case:
for (let i = 0, j = ls.length - 1; i < ls.length; j = i++)
{
...
}
The work I do usually does not care about the performance improvement if there is any, but it feels good to avoid that per-iteration check.
zubspace · 2020-09-07
Very interesting talk. My favorite takeaways:
1) The basic physics of sand, water and gases is quite simple. I was impressed by the fact, that he implemented most of it in Q-Basic way back. Thinking about this a bit more, Q-Basic looks like the perfect environment to play around with such pixel simulations, albeit a bit slow I guess.
2) The hard part is mixing rigidbody simulation and pixel simulation. Also updating the world using multiple threads.
3) Procedural world generation uses something called Herringbone Wang Tiles [1]. It reduces visible seams and the algorithm itself does not look too complicated.
[1] https://nothings.org/gamedev/herringbone/herringbone_tiles.html
Flenser · 2018-12-20
That's just some code that @ephtracy is using.
"ephtracy/stb forked from nothings/stb"
Sean T. Barrett is @nothings on twitter per the twitter link on https://nothings.org/
pixelbath · 2018-12-20
The programmer is Sean T. Barrett:
* https://github.com/ephtracy/stb
* https://nothings.org/
fao_ · 2018-07-10
> Does anyone else have any recommendationed reading for someone like me? My absolute priority is keeping the code simple and having as few features as possible.
http://nothings.org/computer/lexing.html
the focus is on speed, but honestly I found this code easier to read and write (once I got my head around the general concept) than most other parser code I've seen.
beagle3 · 2013-08-15
Obligatory Sean Barrett reference: http://nothings.org/stb/stretchy_buffer.txt - (though, see the warning on http://nothings.org/ about strict aliasing optimizations)
skrebbel · 2012-12-30
if you don't have a not-invented-here symptom, you could also consider re-using the excellent stb stretchy buffers by the excellent Sean Barrett:
http://nothings.org/stb/stretchy_buffer.txt
joe_the_user · 2010-09-02
Excellent point
Further, the article is only an announcement that some benchmarking would be happening later...
But (linked directly from the wikipedia article), this article gives benchmarking and a good argument that a "Judy array" is a rather over-engineered solution: http://www.nothings.org/computer/judy/ (and that article is linked to the wikipedia article).
jemfinch · 2010-06-10
Also worth investiation: a comparison of 20000 lines-of-code Judy versus a 200 lines-of-code hash table: http://www.nothings.org/computer/judy/
crabmusket · 2025-07-19
I had no idea Thief, one of my favourite games, was built with an ECS-like architecture. Two articles with more interesting details about Thief (I especially love its "temporal" CSG world model):
https://nothings.org/gamedev/thief_rendering.html
https://www.gamedeveloper.com/design/postmortem-i-thief-the-dark-proje…
I skipped a fair chunk of the middle of this video as I really wanted to get to the Sketchpad discussion, which I found very valuable (starting around 1:10).
I think Casey was fairly balanced, and emphasized near the end of the talk that some of the things under the OOP umbrella aren't necessarily bad, just overused. For example, actors communicating with message passing could be a great way to model distributed systems. Just not, maybe, a game or editor. Along similar lines, I love this old post "reconstructing" OOP ideas with a much simpler take similar to what Casey advocates for:
https://gamedev.net/blogs/entry/2265481-oop-is-dead-long-live-oop/
But I of course enjoyed him calling out the absolutely dire state of OOP education/tutorials. I satirized this on my own blog ages ago:
https://crabmusket.net/how-i-learned-oop/
In that post I referenced Sandi Metz as an antidote to awful OOP education. I may just have to include Casey as well.
carussell · 2018-04-10
Aside from the many great soundbites in it, the thing I like most about this article is that its author is Sean Barrett, whose background is in game development and as a traditional, pre-Web client programmer. (See [1].)
Usually, the same way that ecosystems stratify around languages, opinions in questions of tech advocacy tends to stratify based on developer background. Most of the progression in web standards that the author is against has been bolstered by the attitude from people that hail from his background. (Roughly, that camp's attitude tends to resemble something like, just give the developer the ability he or she needs in order to do what he or she wants.) It's the exact attitude that gave rise to developer-first QOL improvements like WebAssembly and many other things that have popped up in the nearly 1.5 decades after this was written.
This is notable because that camp's overriding perspective is the exact opposite of the author's own grumble about "your experience interacting with the web could be vastly better, but browser authors are instead caught up in enhancing the abilities of content creators". I.e., the author prioritizes a user-first perspective, recognizing that the developer-first mindset has almost always been in conflict with his ideal vision for the Web, despite his own background.
There's also the really great breakdown of Web content as type #1 vs #2 vs #3, which predates similar descriptions that I'd only seen start to become…
_dcwr · 2018-02-10
I have not heard this 'criticism' ever before and it's absolutely ridiculous on so many levels to me as a person tangentially interested in gamedev, C, C++, runtimes, system programming, retro stuff, history of gaemdev, etc.
1. Why would a web dev suddenly decide to write in such a spartan way an algorithm heavy library in C or C++? This makes no sense except to somehow tie modern web dev failures like left pad with this style of libraries to portray them in negative light...
2. In gamedev neat organization is/was not some golden long standing standard, i.e. in comments under[0] you can find information that with 3D graphics it was customary to use a single file to let the early compilers do a better job since they didn't optimize across translation units and many old codebases have no problem with thousands of lines of spaghetti per file.
3. These libraries are meant to be compiled once ever per project (except when you clean out all your object files) with a define in a single source file (which any modern compiler should handle), otherwise most of their text is thrown away in a single ifdef which should be trivial and speedy on a modern compiler. The resulting header shouldn't be a problem for any modern compiler and is as light or lighter than an entire include tree would be. Most of these libraries are also single purpose and have very small API and C is light compared to template heavy C++ anyway. If you develop such a library you can keep it split up and ship…
tptacek · 2010-05-22
Skip lists and splay trees, two frequent suggestions on this thread, are "lesser known" for a reason: skip lists because for any given skip list implementation there is most probably an encoding of balanced binary trees that outperforms it, even in concurrency, and splay trees because every balanced binary tree outperforms them --- and, in order to avoid writing and testing balancing code, you have to trade off the fact that reading the tree modifies the data structure.
Judy arrays came up once too; there's a really excellent critique of Judy arrays here:
http://www.nothings.org/computer/judy/
(Long story short: you can get comparable performance from a straightforward hash table, and Judy Arrays have to be tuned to the microarchitecture).
Favorite data structure not cited here:
Aguri trees, which marry a bounded-size radix trie (like you'd use in a software routing table) to an LRU list, and automatically synthesize aggregates (like, 10.0.0.0/16 from 1,000 observations across all IPs) from the pattern of insertion. They're best known in traffic analysis, but we've used them on in runtime memory analysis as well.
jareklupinski · 2026-07-20
> https://nothings.org/gamedev/ssao/IMG_0059.JPG
i wonder if this is on purpose to avoid this illusion where i cant tell if im looking at a convex or concave just from three lines
skippyfish · 2026-07-20
I don't think the author makes a persuasive argument. Most of the photos they're analyzing are obviously lit by various point light sources, e.g.:
https://nothings.org/gamedev/ssao/IMG_0064.JPG
You can see a sharp shadow near the door frame. So yeah, ambient occlusion is not going to simulate that, but it was never supposed to?
It's supposed to make 3D shapes look good without the need to place lights or do more complex ray tracing. It roughly approximates what you could perhaps see inside a softbox.
The reason it's used in computer games is mostly that it makes things look better than before with less computational overhead than the alternatives.
a1o · 2026-07-01
I think the biggest issue with Opus is the problem with its specification being lacking, see:
https://nothings.org/stb/stb_opus.html
This essentially causes opus to never be used in games or in things in stores that may have issues with specific licenses.
sebastianmestre · 2024-06-20
Yeah, Sean Barrett has a good writeup about them and optimizing them for branch-prediction, etc
It's framed in the context of programming-language tokenization, but the principles are the same.
https://nothings.org/computer/lexing.html
pekim · 2024-01-03
Sean Barrett, the author of stb_truetype.h, has an interesting article about how stb_truetype does its glyph rasterisation.
https://nothings.org/gamedev/rasterize/
turtledragonfly · 2023-12-30
One interesting application of this technique is how the world is generated in Noika: https://80.lv/articles/noita-a-game-based-on-falling-sand-simulation/
They found that the herringbone pattern hides the grid pretty well and cheaply, relative to other options.
They also credit Sean Barrett's prior work: https://nothings.org/gamedev/herringbone/herringbone_tiles.html
synergy20 · 2023-07-05
I wonder what's the difference among clibraries, ctl verse the well known stb_ds.h at https://nothings.org/stb_ds/ ?
also, glib has lots of goodies and is cross platform too, it's somehow under used in my opinion.
bruce343434 · 2022-07-22
This sounded promising but then I saw a performance benchmark [1] that was done on a pentium(!) with a very suboptimal hash table design compared to [2] and [3].
The Judy site itself [4] is full of phrases like "may be out of date", when the entire site was last updated in 2004. If it was already out of date in 2004...
It seems that Judy arrays are just kind of a forgotten datastructure, and it doesn't look promising enough for me to put in effort to revive it. Maybe someone else will?
[1] http://www.nothings.org/computer/judy/
[2] https://probablydance.com/2017/02/26/i-wrote-the-fastest-hashtable/
[3] https://probablydance.com/2018/05/28/a-new-fast-hash-table-in-response…
[4] http://judy.sourceforge.net/
alliao · 2022-07-07
I got this http://nothings.org/writing/websucks.html so fascinating in 2004 the web already suck
gilbetron · 2022-04-10
https://nothings.org/gamedev/thief_rendering.html#lighting
"The core technique for rendering texture mapped polygons with decent precomputed shadows is very similar (identical?) to Quake. Thief used light mapping and a surface cache to store the lit surfaces. I refer you to Mike Abrash's articles."
Mike Abrash is a cool guy, not as well known as Carmack but had as big, if not bigger, impact on the gaming world. Got to sit in a panel with him and Carmack once at GDC to talk about networking stuff (I wasn't in the actual panel, but it was a tiny room with about 20 people plus the panelist)
MaxBarraclough · 2021-04-23
Work has been done applying the Boyer-Moore principle to regex scanning.
* https://doi.org/10.1016/S0167-6423(03)00013-3 (PDF is freely available)
* https://nothings.org/computer/source/sgrep.html
lasagnaphil · 2021-04-08
A much more simple alternative way of doing this is to use stretchy buffers.
Here's an example of a dynamic array in C in about 20 lines: http://nothings.org/stb/stretchy_buffer.txt
And here's a friendly explanation of how this technique works: https://ourmachinery.com/post/minimalist-container-library-in-c-part-1…