Top all-time · #557
Paul Khuong
Personal blog · pvk.ca/Blogprogrammingmath
Paul Khuong's personal blog at pvk.ca covers programming and math. Since 2010, 106 different Hacker News readers have linked it 197 times, most often “SBCL: Assembly code breadboard (2014)”. It is still writing: the last post was on 2025-12-30, and you can follow it by feed.
Sometimes recommended · 9 of 40 sampled comments recommend it?
Why HN links it
HN readers link pvk.ca for its SBCL, assembly and cache-performance posts, which comments describe as very good and worth a skim.
- Recommended for · 9 comments
- Called very good, a really good article, and worth a skim; one commenter credits it with elegant solutions.
Summarised by Claude from a sample of 40 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
Paul Khuong's personal blog. Some Lisp, some optimisation, mathematical or computer.
Most-linked posts?
- SBCL: Assembly code breadboard (2014)13 people · 15 mentions · first linked 2020-06-10
- SBCL: The Ultimate Assembly Code Breadboard (2014)8 people · 10 mentions · first linked 2016-06-23
- Flatter wait-free hazard pointers6 people · 6 mentions · first linked 2020-07-07
- How to Define New Intrinsics in SBCL (2014)5 people · 9 mentions · first linked 2016-06-30
- Preemption is GC for memory reordering (2019)5 people · 5 mentions · first linked 2022-03-23
- Baseline implementations should be predictable4 people · 4 mentions · first linked 2021-05-14
- Binary Search Is a Pathological Case for Caches4 people · 4 mentions · first linked 2016-11-29
- Binary search is a pathological case for caches4 people · 4 mentions · first linked 2012-07-30
- Binary Search Eliminates Branch Mispredictions (2012)4 people · 4 mentions · first linked 2012-07-04
- Stuff Your Logs3 people · 4 mentions · first linked 2021-01-25
What Hacker News says?
For the record: Returning from an interrupt is fully serializing on x86, which I believe means that all modern operating systems on x86 will handle this properly. https://pvk.ca/Blog/2019/01/09/preemption-is-gc-for-memory-r... is a very good blog post about exploiting this for a high-performance membarrier daemon.
Comment linking /Blog/2019/01/09/preemption-is-gc-for-memory-reordering/
on “A one in a million bug in Switch kernel”Submitted How to Print Integers Really Fast as a story · 169 points
HN discussionI don't know, Clojure was a breath of fresh air when I first learned it and it's definitely more fun than what's shown in this post on a day-to-day, this post is just whimsy... (Though truly the more Java interop you need, the less pleasant it becomes.) But I agree Common Lisp is even more fun than that. It can also do the same sort of madness as this post shows. Here's my favorite related blog about it, even though…
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “Hexing the technical interview (2017)”Submitted SBCL: The Ultimate Assembly Code Breadboard as a story · 159 points
HN discussionSB-ASSEMB, for example. https://www.pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembl...
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “Computer Science from the Bottom Up (2013)”Submitted 0x7FDE623822FC16E6: A magic constant for double float reciprocal (2011) as a story · 158 points
HN discussionhttps://github.com/dym/movitz is a Common Lisp system that runs on bare metal x86. The source code is quite readable. The rest of this post is an excerpt from an email I sent 6 years ago. The following comments on runtime systems are partially based on a long c.l.l thread with posts by Lucid, Symbolics, and Franz alumni. Franz uses a 3-layer approach: CL, a low-level Lisp, and C. Lucid started with Lisp that generat…
Comment linking /Blog/2014/08/16/how-to-define-new-intrinsics-in-sbcl/
on “Curl is C”Submitted SBCL: Assembly code breadboard (2014) as a story · 134 points
HN discussionIn embedded systems using MCUs with very little memory (AVR comes to mind) assembly might be preferred over high level languages (very generously counting C as HLL here). It might even be fun (for truly launch-and-forget projects -- don't even think about maintaining such code) to forgo structured programming and get creative with control flow and self-modifying code. As a systems engineer it's good to know _some_ x…
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “Let's Learn x86-64 Assembly (2020)”Submitted The Unscalable, Deadlock-Prone, Thread Pool as a story · 122 points
HN discussionNot only is it wasting memory, but I wouldn't be convinced it'd not be outright hurting performance by increasing cache line aliasing, increasing TLB overhead and misses/invalidations! Avoiding page alignment can be a performance gain! https://pvk.ca/Blog/2012/07/30/binary-search-is-a-pathologic... Like, sure, mapping your executable's code section in at a page boundary is probably fine, but I think trying to align…
Comment linking /Blog/2012/07/30/binary-search-is-a-pathological-case-for-caches/
on “Dynamic linking”Submitted SBCL: The Ultimate Assembly Code Breadboard (2014) as a story · 122 points
HN discussionHere are a bunch of blogs from my RSS reader that I think are worth reading. Some of them haven't updated in a while, but the archives may be worth a look anyway. * Blogs with a math focus: http://blog.sigfpe.com http://bit-player.org http://mathr.co.uk/blog/ https://www.johndcook.com/blog/ * Blogs with a programming languages focus: https://existentialtype.wordpress.com https://bluishcoder.co.nz http://blog.ezyang.…
Comment linking /
on “Ask HN: What programming blogs do you follow?”Submitted Stuff Your Logs as a story · 118 points
HN discussionRegisters vs x87 stack with free swap a.k.a. rotating stack. Sub-optimal edge cases for both exist: [1] http://cr.yp.to/qhasm/20050210-fxch.txt [2] https://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-co...
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “How do modern compilers choose which variables to put in registers?”Submitted Tabasco Sort: a super-optimal merge sort as a story · 109 points
HN discussionFor the longest time I viewed kernel programming as an exalted realm of "optimized bare-metal software written by visionaries and wizards" (like operating system core developers of the Dave Cutler variety). Having had the misfortune of dabbling in reverse-engineering Windows drivers and debugging in-tree Linux kernel drivers, I now believe they're often messy hackjobs written by low-paid average-skilled embedded dev…
Comment linking /Blog/2019/01/09/preemption-is-gc-for-memory-reordering/
on “A list of developer questions to ask prospective employers”Submitted How to Define New Intrinsics in SBCL as a story · 92 points
HN discussion> if there's a "true low level language" for today I'd like to hear about it "Steel Bank Common Lisp: because sometimes C abstracts away too much" https://www.pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembl... ATS - C plus everything you could get from modern types, including type-safe pointer arithmetics https://www.youtube.com/watch?v=zt0OQb1DBko Compiling Haskell to hardware http://conal.net/blog/posts/haskell-t…
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “C Is Not a Low-level Language (2018)”Submitted Plan B for UUIDs: double AES-128 as a story · 91 points
HN discussion> Most of the effort of spinning up a new language is in the backend (optimization and error checking), where lisp doesn't offer a compelling advantage SBCL literally allows writing compiler intrinsics (and I'm talking about native machine code, not bytecode) at runtime out of the box: https://www.pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembl...
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “Lisping at JPL (2002)”Submitted Binary Search Eliminates Branch Mispredictions (2012) as a story · 89 points
HN discussionReminds me of this great article on writing a fast mergesort: http://pvk.ca/Blog/2012/08/13/engineering-a-list-merge-sort/
Comment linking /Blog/2012/08/13/engineering-a-list-merge-sort/
on “Lomuto's Comeback”Submitted Starting to Hack on Steel Bank Common Lisp as a story · 88 points
HN discussionActually SBCL (and other CL impls) still follow this tradition; cf. https://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-co... You can also use the new sb-simd to play around with vectorization in the interpreter. Okay you'll break something, but it's such joy while you do it. C/C++ and other "strictly-separated compilation" languages OTOH seem so dogmatic and stupid now. It's no surprise why development is no…
Comment linking /Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
on “Byte Magazine: LISP (1979)”Submitted Too much locality for stores to forward as a story · 86 points
HN discussionI see a lot of people asking for a real use case. If you follow the reference chain in the first aside, you'll find this blog post of mine https://pvk.ca/Blog/2020/07/07/flatter-wait-free-hazard-poin... . where we use value speculation to keep MOVS out of the critical path in an interrupt-atomic read sequence for hazard pointers.
Comment linking /Blog/2020/07/07/flatter-wait-free-hazard-pointers/
on “Beating the L1 cache with value speculation (2021)”Submitted SBCL: The Assembly Code Breadboard as a story · 81 points
HN discussionSbcl has all the pieces in place for vectorization, but I don’t think anyone has actually hooked them up. However the great thing about lisps is that the compiler and optimizer are written in the language they compile, so an end user can do this sort of thing themselves: https://www.pvk.ca/Blog/2013/06/05/fresh-in-sbcl-1-dot-1-8-s...
Comment linking /Blog/2013/06/05/fresh-in-sbcl-1-dot-1-8-sse-intrinsics/
on “Numpy Clone in Common Lisp”Submitted Binary search is a pathological case for caches as a story · 80 points
HN discussion