Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions en-US/2025-06-09-c-fundamentals/0-introduction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ I mentioned this because this context is relevant for a lot of the design decisi
It's not you have somebody who's really dogmatic about their formatting and saying, you must stick to 80 character width as a matter of our formatting configuration. It's no, no, no, 80 characters is literally all you get, and that's it. The physical printer does not go past 80 characters [LAUGH] so that's all you got to work with.

[00:04:43]
That type of thing. Also, they had a lot of performance constraints. So the PDP-11 had a whopping 256 kilobytes of memory. It had 1-core single CPU. So no multi-core anything, no parallel processing of any kind. It ran at a blistering 125 kilohertz on that 1-core. So not only was it 110 of a megahertz, not even close to a gigahertz.
That type of thing. Also, they had a lot of performance constraints. So the PDP-11 had a whopping 256 kilobytes of memory. It had 1-core single CPU. So no multi-core anything, no parallel processing of any kind. It ran at a blistering 125 kilohertz on that 1-core. So not only was it 1/10 of a megahertz, not even close to a gigahertz.

[00:05:04]
So this is essentially the world that they were living in when they designed and developed C. Despite that they were able to build a language that supported building all of these tools that we still use today. Which then leads to the question, if this was the language that they were building for this kind of hardware, why would people still use it on modern hardware when modern hardware runs so much faster?

[00:05:26]
Well, one of the things you might notice about all of these pieces of software on the screen here is that they're all things that really, really care about performance. They're things where if you can get something to run acceptably fast on this kind of hardware, imagine what you can do with something that has 3264, gigabytes of memory and 16-core CPU and multiple gigahertz.
Well, one of the things you might notice about all of these pieces of software on the screen here is that they're all things that really, really care about performance. They're things where if you can get something to run acceptably fast on this kind of hardware, imagine what you can do with something that has 32, 64 gigabytes of memory and 16-core CPU and multiple gigahertz.

[00:05:47]
Yeah, you can get something that runs very, very fast on modern hardware. So fundamentally, what people sort of jokingly, kind of half seriously refer to C as is portable assembly. And assembly language is essentially one very thin layer of abstraction on top of hardware machine instructions that the CPU understands.
Expand Down Expand Up @@ -100,7 +100,7 @@ And also, finally, C is the language that other languages use to talk to each ot
So if you want to do, for example, interop between Node.js and other language, Node.js supports C interop. Haskell, which we talked about earlier, has C interop. Rust has C interop. Pretty much every language has some sort of C interop. Really, one of the only exceptions to this, technically, would have been JavaScript in the browser, which, for a long time, had absolutely no way to talk to C, although now through WebAssembly, that is kind of possible.

[00:09:29]
But it's really taken off as this way to have one language talk to another one. If you've got Python embedded in Rust, or something like that. The way that Python and Rust are interacting and talking to each other is using C as an intermediary or at least the C ABI, which is essentially the way that C represents things in memory even if it's not literal.c files.
But it's really taken off as this way to have one language talk to another one. If you've got Python embedded in Rust, or something like that. The way that Python and Rust are interacting and talking to each other is using C as an intermediary or at least the C ABI, which is essentially the way that C represents things in memory even if it's not literal .c files.

[00:09:50]

Expand Down
6 changes: 3 additions & 3 deletions en-US/2025-06-09-c-fundamentals/0-introduction.vtt
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ kilohertz on that 1-core.

102
00:04:59.458 --> 00:05:04.878
So not only was it 110 of a megahertz,
So not only was it 1/10 of a megahertz,
not even close to a gigahertz.

103
Expand Down Expand Up @@ -539,7 +539,7 @@ something to run acceptably fast on this
114
00:05:38.300 --> 00:05:43.193
kind of hardware, imagine what you
can do with something that has 3264,
can do with something that has 32, 64

115
00:05:43.193 --> 00:05:47.354
Expand Down Expand Up @@ -924,7 +924,7 @@ at least the C ABI, which is essentially
195
00:09:46.308 --> 00:09:50.376
the way that C represents things in
memory even if it's not literal.c files.
memory even if it's not literal .c files.

196
00:09:50.376 --> 00:09:52.986
Expand Down
8 changes: 4 additions & 4 deletions en-US/2025-06-09-c-fundamentals/1-why-c-is-popular.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ And not because it does amazing optimizations, although it does lots of those tw
C++ is extraordinarily complicated and the compile times are massively longer than they are for C. So, C is still popular even in a world where C++ exists, even though C++ was designed to be the improvement over C. Because C++ added so much complexity and so much longer compile times that a lot of people are like, yeah, I know C and C++ and I prefer C.

[00:01:00]
One really direct example of what C gets you in terms of performance is what I'm gonna call the Local Static HTTP Server Perf Olympics. This is not a real competition. This is very unscientific, and it was done by me very quickly by measuring some different static HTTP servers and just loading up a download of the FrontendMaster's website.
One really direct example of what C gets you in terms of performance is what I'm gonna call the Local Static HTTP Server Performance Olympics. This is not a real competition. This is very unscientific, and it was done by me very quickly by measuring some different static HTTP servers and just loading up a download of the FrontendMaster's website.

[00:01:19]
And seeing how fast they were able to load it into the browser. Very unscientific, but also a little bit of fun. So in third place with the bronze, we had Node.js. So this is Node's HTTP server package. This has about 2.3 million weekly downloads, it's extremely popular. It's the most popular way to do a static HTTP server in the Node.js ecosystem.
Expand All @@ -23,15 +23,15 @@ And it is the about 300 lines of C code we write in this workshop with only the
It's like, all of these are about under ten milliseconds of response time to like load all the different assets statically. But nevertheless, it is the case that pretty consistently, you can see that even though we're not really like, I didn't sit down and benchmark this, other than this silly little performance Olympics thing.

[00:02:28]
I didn't sit down and performance optimize the C thing. These are very mature, well written, well established, designed to be high performance HTTP servers written in Rust. Which has a reputation for Being a very fast language, and Node js, which, granted, has a lot more overhead than rust or C.
I didn't sit down and performance optimize the C thing. These are very mature, well written, well established, designed to be high performance HTTP servers written in Rust. Which has a reputation for being a very fast language, and Node.js, which, granted, has a lot more overhead than Rust or C.

[00:02:44]
And still, just this example that I just made for this workshop, just by doing some basic bread and butter, just do things the way that kind of C encourages. We're able to get really, really fast performance just because C is just really, really not adding anything, even compared to Rust, yeah.

[00:02:59]

>> Speaker 2: Is it Node relying on C++ anyway as well to do that?
>> Richard Feldman: Yeah, so Node, under the hood, certainly the Node runtime is gonna be V8, and V8 is written in C++. It's multiple millions of lines [LAUGH] of C++ code, and billions, it takes forever. But yes, so when you're running your Node HTTP server, you are definitely executing a lot of code that was written in C++, nearly the JavaScript Virtual Machine, V8.
>> Richard Feldman: Yeah, so Node, under the hood, certainly the Node runtime is gonna be V8, and V8 is written in C++. It's multiple millions of lines [LAUGH] of C++ code, and building it takes forever. But yes, so when you're running your Node HTTP server, you are definitely executing a lot of code that was written in C++, namely the JavaScript Virtual Machine, V8.

[00:03:24]
Yeah, [LAUGH] and nevertheless, [LAUGH] here we are. Cool, I do wanna mention there are some low overhead C alternatives. We're not gonna get into them in this course, but I do wanna at least mention them. So C++, of course, is like definitely the most popular of these, very, very complex.
Expand All @@ -43,7 +43,7 @@ It's absolutely huge, especially in the game dev space, but not just in game dev
Nowhere near C++ levels of popularity, but Zed, like the code editor that I work on at work, Biome, which is the successor to Roam written in Rust. That's like a JavaScript ecosystem thing. Ripgrep, really popular, like grep alternative at the command line. I have a course on FrontendMasters about that if you wanna learn how to do Rust.

[00:04:18]
Zig, also very nice language, you might go see the terminal emulator bond in the JavaScript ecosystem, you might've heard of tiger beetle rock. The programming language I'm making is in the process as we speak of rewriting our compiler from rust to Zig. And there's plenty of other, this is like D, Odin, JAI, Carbon, lots of different languages are trying to say, hey, C has so many nice properties, but the ergonomics, there's just some problems with it.
Zig, also very nice language, you might use Ghostty the terminal emulator. Bun in the JavaScript ecosystem, you might've heard of TigerBeetle, Roc, the programming language I'm making is in the process as we speak of rewriting our compiler from Rust to Zig. And there's plenty of others. There's like D, Odin, JAI, Carbon, lots of different languages are trying to say, hey, C has so many nice properties, but the ergonomics, there's just some problems with it.

[00:04:43]
It doesn't feel like a modern language because it's like half a century old. And people are trying to modernize it, hopefully without sacrificing the things that make it popular in the first place. Okay, all of these low overhead C alternatives definitely support C interop. So, not just languages that are trying to be C alternatives, but also like we said, Node.js and others, really, C interop is almost universal, because C is like the language that other languages use to talk to each other.
Expand Down
24 changes: 12 additions & 12 deletions en-US/2025-06-09-c-fundamentals/1-why-c-is-popular.vtt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ you in terms of performance is what I'm
21
00:01:05.098 --> 00:01:08.292
gonna call the Local Static
HTTP Server Perf Olympics.
HTTP Server Performance Olympics.

22
00:01:08.292 --> 00:01:09.987
Expand Down Expand Up @@ -243,13 +243,13 @@ HTTP servers written in Rust.

51
00:02:39.602 --> 00:02:42.847
Which has a reputation for Being a very
fast language, and Node js, which,
Which has a reputation for being a very
fast language, and Node.js, which,

52
00:02:42.847 --> 00:02:44.937
granted, has a lot more
overhead than rust or C.
overhead than Rust or C.

53
00:02:44.937 --> 00:02:49.679
Expand Down Expand Up @@ -289,7 +289,7 @@ and V8 is written in C++.
60
00:03:11.196 --> 00:03:15.130
It's multiple millions of lines [LAUGH] of
C++ code, and billions, it takes forever.
C++ code, and building it takes forever.

61
00:03:15.130 --> 00:03:19.927
Expand All @@ -299,7 +299,7 @@ HTTP server, you are definitely executing
62
00:03:19.927 --> 00:03:24.738
a lot of code that was written in C++,
nearly the JavaScript Virtual Machine, V8.
namely the JavaScript Virtual Machine, V8.

63
00:03:24.738 --> 00:03:30.384
Expand Down Expand Up @@ -381,12 +381,12 @@ that if you wanna learn how to do Rust.
79
00:04:18.020 --> 00:04:21.220
Zig, also very nice language,
you might go see the terminal
you might use Ghostty the terminal

80
00:04:21.220 --> 00:04:25.881
emulator bond in the JavaScript ecosystem,
you might've heard of tiger beetle rock.
emulator. Bun in the JavaScript ecosystem,
you might've heard of TigerBeetle, Roc,

81
00:04:25.881 --> 00:04:30.527
Expand All @@ -395,12 +395,12 @@ the process as we speak of rewriting our

82
00:04:30.527 --> 00:04:32.088
compiler from rust to Zig.
compiler from Rust to Zig.

83
00:04:32.088 --> 00:04:35.659
And there's plenty of other,
this is like D, Odin, JAI, Carbon,
And there's plenty of others.
There's like D, Odin, JAI, Carbon,

84
00:04:35.659 --> 00:04:40.032
Expand Down
Loading