Try Pro free

The Peterman Pod · 3 min · Oct 26, 2026

C ran fastest in Kernighan’s language comparison

Brian Kernighan compared a simple text-reflow program in more than two dozen languages: C ran fastest, awk was shortest, and Haskell took weeks.

In this episode

Full analysis
  1. 16:33Bell Labs judged research over years, not weekly output4 min
  2. 54:06Princeton expects computer science majors to fall sharply4 min
  3. 39:38C succeeded by balancing efficiency and expressiveness3 min
  4. 27:55Ken Thompson built a Unix system in three weeks6 min
  5. 43:59Awk combined three researchers’ interests in a weekend build4 min
  6. 1:11:12AI-generated code still needs expertise to verify6 min
  7. 1:19:54C ran fastest in Kernighan’s language comparison3 min
Up next · The Pragmatic EngineerUse deterministic rewrites for large codebase changes8:15
“c was always the fastest but it was harder because you had to worry about memory management a bit”
Brian Kernighanat 1:21:37 · The Peterman Pod
1:21:37

Takeaways

  1. The test reflowed arbitrary-length text into lines of at most 60 characters.
  2. C ran fastest; awk’s solution was about 15 lines.
  3. Haskell took weeks to write, while Lua took about half an hour.

About this segment

Brian Kernighan compared a simple text-reflow program in more than two dozen languages: C ran fastest, awk was shortest, and Haskell took weeks. His test exposed trade-offs on a real, small task.

Brian Kernighan

Brian Kernighan is a former Bell Labs member of technical staff and co-author of the original C book.

Co-authored The C Programming Language and helped develop influential programming tools, including awk.

  • Ryan Peterman, Host · Host, The Peterman Pod

    Went from new grad to staff engineer at Instagram in three years.

From “Brian Kernighan: Inside Bell Labs, The Best Programmer, Why C Won”, Oct 26, 2026. Watch the full episode

Transcript

Transcribed by machine (Whisper) from the episode’s audio, so a word may be off here and there.

  1. 1:19:59

    When you look across... your whole career because you've worked in a bunch of different programming languages and you've taught a bunch of different ones. Are there any that stick out to you as your favorite or your least favorite? If I think about what I do on a day-to-day basis, if I write a program, it tends to be a small one and it's in awk. It's just kind of silly, but okay. At least I know it.

  2. 1:20:25

    If I were to write bigger ones, I would almost surely write them in Python, because for many things, that's the right compromise. It's certainly efficient enough for anything I do, and it's totally expressive for the kinds of things I might want to do. I will occasionally go back to C because I've got some older program, and maybe I want to do something with it, or as I've said, I'm teaching it at this point.

  3. 1:20:47

    So those are kind of the languages that I wind up using. Not very many are other languages I wouldn't use. so who shall I insult today? I used to, in my class, I haven't done this for a long time, but I used to basically write the same program in as many languages as I could find. It was a simple program. You would take text input lines of arbitrary lengths and put them out so that the lines were all at most 60 characters or something. So it was a simple minded version of the reflow that you would see in a in a browser and i would write it in every language i could lay my hands on i had two dozen or more of them and i'd show them in class and the question is which ones ran faster and which ones were in some sense small or easy to understand or whatever and lock was pretty fast and it was the smallest always there's about 15 lines of code to

  4. 1:21:40

    do this job and c was always the fastest but it was harder because you had to worry about memory management a bit and it was clunky to do strings and the other scripting languages like Perl and Python and PHP and you know they were variously sort of okay. Perl was always the faster one and some of the high-powered languages that were supposed to be better were actually slower. Java was slower than the scripting languages. Kind of weird. C++ wasn't as fast as I thought it would be And at the far end of it was Haskell.

  5. 1:22:16

    And it took me weeks to write the Haskell program, whereas Lua, a language I had never touched, took me about half an hour. I look at the manual. Oh, I see. Done. Whereas Haskell took forever. And then I showed it to some Haskell expert. He said, oh, but you have to import this character library that does this, and then it ran faster. What made Haskell take so long? It's a different way of thinking.

  6. 1:22:39

    and I just didn't rock it. I really didn't. And I think part of it was the problem is you're taking input in one form and not asynchronously but not at the same cycle you're trying to produce output. So your lines are at varying lengths and you're going to produce lines at the same length and that mismatch of input and output kind of frequency didn't fit naturally with Haskell as I understood it. Now, this is not a knock on Haskell.

  7. 1:23:10

    I mean, there are people who love it, but I'm not one of them.