Lighterra
lighterra.com · Personal blog · on HN since 2011
Personal site of a developer with technical papers on CPU design, compilers, register allocation, exception handling, and video encoding.
What HN saysCommenters cite the microprocessor guide as a good intro, though one says its microarchitecture sections are dated. The exceptions essay is cited in error-handling debates.
44HN people shared it
23linked it in comments
26stories submitted
1.4Kstory points
7 months agolast shared
2011people per year2026
Most-shared posts
- 1Modern Microprocessors – A 90-Minute Guide (2001-2016)24 people · 1.3K points · first shared 2011 · 87 comments on HN
- 2Exception Handling Considered Harmful12 people · 8 points · first shared 2014 · 1 comments on HN
- 3Macosxtextaabug3 people · first shared 2014
- 4Video Encoding Settings for H.264 Excellence2 people · 13 points · first shared 2020 · discussion on HN
- 5Basicinstructionscheduling2 people · first shared 2017
- 6Register Allocation by Graph Coloring (2003)1 people · 40 points · first shared 2016 · 11 comments on HN
- 7The history of computers during my lifetime1 people · 2 points · first shared 2015 · discussion on HN
- 8Modern Microprocessors – A 90-Minute Guide1 people · 1 points · first shared 2026 · discussion on HN
- 9Brainiacs14.png1 people · first shared 2011
What HN people wrote when they linked it
dhash · 2024-12-30
My favorite illustrations for the concepts discussed here (in an accessible form, not the processor optimization manuals) has long been [0].
For me, this really makes working with a modern microprocessor a science, as anyone who has written benchmarks knows -- it's difficult to reason about the complex behaviour and performance cliffs without testing.
Another excellent example of the weirdness has to be JVM anatomy quarks [1]
[0] https://www.lighterra.com/papers/modernmicroprocessors/
[1] https://shipilev.net/jvm/anatomy-quarks/
chainingsolid · 2024-03-03
Here's 2 more links. I didn't see already posted worth watching/reading. Should give a good intro. Within 3 hours combined (For CPU performance anyway).
A good talk, doesn't go deep and instead goes a bit wide. https://www.youtube.com/watch?v=6RlloT_6WxA
This one explains the black magic the CPU makes have been doing. If you going to be optimizing code you should know your hardware. https://www.lighterra.com/papers/modernmicroprocessors/
Aditional note: I've noticed C++ conventions have a habit of having performance related talks, YT is your friend.
ghoward · 2021-09-14
Not GP.
I think a great article detailing why exceptions are not desirable is http://www.lighterra.com/papers/exceptionsharmful/ .
> The question mark isn't necessary at all. Why would you pollute your code with additional character? It just says "I want to have a broken application that does not react to an error if I forget to put in a question mark"
I'm no Rust expert, but I think the compiler will error if you don't put the question mark?
mhh__ · 2021-03-14
Probably worth pointing out that the sections on microarchitecture stopped being representative with the pentium pro in the mid 90s. The processor still has a pipeline, but it's much harder to stall it like that.
http://www.lighterra.com/papers/modernmicroprocessors/ is a good guide (Agner Fog's reference isn't really a book so I don't recommend it for the uninitiated)
ScottFree · 2019-07-17
If/else provides a clear and easy to follow control flow. try/catch is like a roaming goto that works it's way back up your stack in ways you can't predict.
http://www.lighterra.com/papers/exceptionsharmful/
dr_zoidberg · 2019-05-21
There's a very good article [0] that makes rounds here very now and then. It gives a very good explanation of many of those concepts, while remaining understandable for those that haven't taken CPU design courses.
[0] http://www.lighterra.com/papers/modernmicroprocessors/
Edit: It'd be great a 2019 refresh (last update is from 2016) talking about Ryzen and the newer Intel designs.
deepnotderp · 2017-06-29
A tiny nitpick, and I don't mean to be pedantic, but "in-flight" usually is used to describe an instruction in the functional units, not "in the pipeline".
Other than that it's a pretty good introductory article!
If you'd like something a little heartier, but still not quite Hennessy and Patterson's QCA (although I highly recommend it), try this article: http://www.lighterra.com/papers/modernmicroprocessors/
fizixer · 2014-10-28
Please. This is not relevant almost 12 years later!
Moore's law is saturating. Benchmarks numbers are more and more a function of core-count not GHz-count. It's time to embrace the RISC-y tiny speed-demon cores (so you can have them by the dozens) over complex brainiac ones (too much space). It's been almost 9 years Intel introduced dual cores and the mainstream is still quad-core (with 6 and 8 on the fringes) while GHz is less that what P4 had more than 10 years ago! What is going on? If Moore's law still holds, in 9 years since 2005 Intel should be at 24/32/48 core ballpark, something that is clearly not the case.
In that vein I would also state that linux needs a major overhaul, i.e., to shift itself from a single core kernel to one that leverages n-cores.
good read: http://www.lighterra.com/papers/modernmicroprocessors/
ssokolow · 2023-08-14
It's been said many times that Go feels like a language written by people who stopped paying attention to programming language research after the 1990s, as well as that it was written by people who look at C and think the only things that are less than perfect about it in the modern world are memory-safety and lack of a first-class concurrency story.
Some examples (not an exhaustive list):
1. Fibers/stackful coroutines (See "Fibers under the magnifying glass" by Gor Nishanov for why they were hugely popular in the 90s and then got abandoned by all the major OSes and programming languages → http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1364r0.pdf)
2. Garbage collection (The 90s were the height of GC hype, to the point that the JVM still struggles with "Don't worry. GC research will make it fast." design decisions.)
3. Error handling that feels like "Well, we know that exceptions were a mistake, so the only other option is C-style return values... but, hey, we can at least follow 90s Python's lead in supporting returning tuples." (Granted, exceptions DO bake in a fundamental assumption that all the world can be treated as single-threaded execution amenable to transactional rollback. → https://www.lighterra.com/papers/exceptionsharmful/)
4. No generics until they were pushed into it by things like people writing preprocessors that use the Canadian Aboriginal Syllabics characters that look like angle brackets.…
Gracana · 2022-03-17
> maybe that's just how fonts are supposed to look and Mac OS has warped my perception
Well, Mac OS users lived with this serious rendering bug for more than a decade: https://www.lighterra.com/articles/macosxtextaabug/
I remember that look well, and even thought that was how text was supposed to look. I stopped using Mac OS before that bug was fixed, so I don't know what else may be going on over there. However, there was a period where a lot of websites looked terrible on non-Macs because Mac-using designers would set really light font weights, which apparently looked fine with Apple's font rendering. Were they right, while everyone else was wrong? I don't know.
Nowadays I run pretty-much-default Ubuntu linux with a 4k display, and I think fonts throughout my system and the web look great, both compared to my iPhone (which also looks great) and compared to my standard definition Windows setup at work (which looks anywhere from 'bad' to 'fine', depending on the program, font, scaling, etc).
bschne · 2026-04-16
according to the title, I believe this should link here: https://www.lighterra.com/papers/modernmicroprocessors/
krackers · 2024-07-29
As a pre-read you should also go through https://www.lighterra.com/papers/modernmicroprocessors/.
neilmovva · 2023-08-07
I like this review:
https://www.lighterra.com/papers/modernmicroprocessors/
A bit dated, but the major ideas used in current CPUs are all covered!
nevir · 2021-11-24
This has been a known bug for well over a decade: https://www.lighterra.com/articles/macosxtextaabug/
I wouldn't hold your breath on a rendering fix
Apple 'fixed' it in 10.14 by disabling subpixel anti-aliasing all together (what this post argues against)
DarkWiiPlayer · 2019-02-20
So, if I understand it correctly, the text argues in favor of the GPU approach of pipelining independant vector operations instead of the current SIMD approach.
I see how this could be beneficial, specially when writing codes, as it's way closer to just a normal loop.
Then again, why not combine both ideas and pipeline chunks of SIMD type? Say we have 4 execution stages and 32bit SIMD types (unrealistic, I know) and want to process 8-bit numbers. Wouldn't we be able to process 16 of them at the same time? Actually, isn't that kind of what GPUs already do?
I'm sure smarter people than I have reasoned about this, maybe someone can link a good article. I only know of this one [1] and one about GPGPU that I just can't find any more (but which was also very interesting)
[1] http://www.lighterra.com/papers/modernmicroprocessors/
68c12c16 · 2018-10-06
Sure...You are welcome! And if you are interested in processor level parallelism, here is a very good article to read for start...
http://www.lighterra.com/papers/modernmicroprocessors/
barrkel · 2017-02-21
Registers are also the nodes in the DAG of evaluation. Superscalar execution relies on having multiple edges active over time. Thus, good register allocation won't have bottlenecks, and won't make the evaluation DAG look like a series of linked lists.
There's a nice overview for people with a passing interest here: http://www.lighterra.com/papers/basicinstructionscheduling/
MetaCosm · 2015-04-27
Read this: http://www.lighterra.com/papers/exceptionsharmful/
There is a reason exceptions are often banned from environments and it isn't because they are awesome. They make code "exceptionally" (zing) hard to reason about.
Kronopath · 2014-03-07
The fact that light-on-dark text looks terrible on Macs isn't due to gamma—it's due to the fact that subpixel rendering for light-on-dark text is broken on Macs.
More info:
http://www.lighterra.com/articles/macosxtextaabug/
Generally I like Mac OS X's font rendering much better than Windows's, but this is one aspect that drove me up the wall when I was redesigning my personal website. (I wrote a bit about the issues I had with this bug in this article: http://kronopath.net/blog/dawn-of-a-new-day/. Search for "The bug".)
sehugg · 2014-02-07
For those that are mainly software-oriented, the Lighterra overview posted earlier is helpful background for understanding where VLIW fits into the zoo of CPU architectures:
http://www.lighterra.com/papers/modernmicroprocessors/
ck2 · 2011-04-10
I enjoyed that, though a bit was still over my head.
I like how a 500mhz ARM cpu is as fast as a 1.6ghz Atom
http://www.lighterra.com/papers/modernmicroprocessors/brainiacs14.png
http://www.osnews.com/story/22704/Intel_Atom_vs_ARM_Cortex-A9
High-end smartphones by the end of this year will be more powerful than many netbooks.
posobin · 2021-05-02
Previous discussions:
2018, 87 comments: https://news.ycombinator.com/item?id=18230383
2016, 12 comments: https://news.ycombinator.com/item?id=11116211
2014, 37 comments: https://news.ycombinator.com/item?id=7174513
2011, 30 comments: https://news.ycombinator.com/item?id=2428403
This link has also appeared in 9 comments on HN, featuring threads on "Computer Architecture for Network Engineers", "X86 versus other architectures" by Linus Torvalds, and "I don't know how CPUs work so I simulated one in code", also recommending a udacity course on how modern processors work (https://www.udacity.com/course/high-performance-computer-architecture-… https://ampie.app/url-context?url=lighterra.com/papers/modernmicroproc…
Jason also has a couple of other interesting articles on his website, like intro to instruction scheduling and software pipelining (http://www.lighterra.com/papers/basicinstructionscheduling/) and the one I liked a lot and agree with called "exception handling considered harmful" (http://www.lighterra.com/papers/exceptionsharmful/).
mikeschinkel · 2019-07-19
> That's why exceptions work so well in most languages
But there are many people including some well-known and highly-respect people who believe that exception handling in fact does not actually work well:
- https://www.joelonsoftware.com/2003/10/13/13/
- https://blogs.msdn.microsoft.com/larryosterman/2004/09/10/structured-e…
- https://www.atlassian.com/blog/archives/exceptions_are_bad
- https://stackoverflow.com/a/1736320/102699
- http://xahlee.info/comp/why_i_hate_exceptions.html
- http://www.lighterra.com/papers/exceptionsharmful/
#justsaying