C has no HTTP client, no TLS and no JSON, so the spec's rule for languages without a transport applies: one named library, and it counts towards size. The library is libcurl, which is what every C program that speaks HTTP has linked for twenty-five years. The JSON is written by hand, because the alternative is a second library and the scanner this protocol needs is ninety lines. The result is the fastest client on the leaderboard, and it got there on the third build, after the first one came in slower than C#.
The code is at github.com/AndyCross/claude-hot-path, 271 lines once blanks and comments are taken out, built with GCC 14.2 against libcurl 8.23.0, the release from 14 October.
One source file, three leaderboard rows
The obvious build is apt-get install libcurl4-openssl-dev and gcc client.c -lcurl. That produces a 66 KB binary, the smallest compiled artefact in the series by a factor of seven. It also produces a 3.6 ms cold start, behind Zig, Rust, Go and C# Native AOT, with 12 MB of peak memory.
The binary is not the program. ldd on it lists 32 shared libraries: libcurl, OpenSSL, nghttp2 and nghttp3, libssh2, librtmp, LDAP, Kerberos, SASL, GnuTLS and its three dependencies, libidn2, libpsl, zlib, brotli and zstd. Debian's libcurl is built to speak every protocol curl has ever supported, and a program that links it loads all of that before main runs. The harness sums the libraries a binary links into its runtime column, the same way it prices bash's interpreter and curl's, and the sum is 21.8 MB. The loader resolving those 32 files is where the 3.6 ms goes. The client itself, once running, has the best turnaround on the board.
The second build compiles curl from source with everything but HTTP switched off, links it statically against Debian's OpenSSL, and links the whole program statically:
./configure --disable-shared --enable-static --with-openssl \
--disable-ftp --disable-file --disable-ldap --disable-rtsp --disable-dict \
--disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb \
--disable-smtp --disable-gopher --disable-mqtt --disable-proxy --disable-cookies \
--disable-doh --disable-alt-svc --disable-hsts --disable-websockets --disable-ntlm \
--without-zlib --without-brotli --without-zstd --without-libidn2 --without-nghttp2
Cold start halves to 2.0 ms and memory to 6 MB. The binary is 7.2 MB, bigger than Go's, and nearly all of it is libcrypto.a. OpenSSL 3 ships its algorithms as one provider, so a static link that wants TLS 1.3 gets every cipher, every hash and every key format whether the linker can prove them unused or not.
The third build changes one configure flag, --with-mbedtls instead of --with-openssl. mbedTLS is a TLS library written for embedded targets, and it is one of curl's supported backends, so the client's own code does not change at all. The static binary drops to 2.1 MB, the cold start to 1.3 ms, and the total to 2.8 ms, ahead of Rust's 3.2. That is the row on the board. All three are the same 271 lines of C; the language set the floor and the library chose the row.
A JSON scanner in ninety lines
Every other client in this series parsed the events into a tree and asked it questions. In C that means picking a JSON library, and the spec allows one named library, which is already spent on the transport. So the scanner is written for this protocol and nothing else: find a key at the top level of an object, hand back a pointer at its value, and decode a string when one is actually wanted.
// The value for key in the object at p, or NULL. Keys in this protocol carry
// no escapes, so the comparison is on raw bytes.
static const char *get(const char *p, const char *key) {
if (!p || *(p = ws(p)) != '{') return NULL;
size_t klen = strlen(key);
p = ws(p + 1);
while (*p == '"') {
const char *k = p + 1, *end = skip(p);
p = ws(end);
if (*p != ':') return NULL;
p = ws(p + 1);
if ((size_t)(end - 1 - k) == klen && memcmp(k, key, klen) == 0) return p;
p = ws(skip(p));
if (*p == ',') p = ws(p + 1);
}
return NULL;
}
skip steps over one complete value, whatever it is, by counting brackets and honouring string escapes, and that is the whole of the parsing. Nested lookups chain: the stop reason is get(get(ev, "delta"), "stop_reason"), and get on a NULL returns NULL, so a missing field anywhere in the path reads as absent rather than as a crash. Nothing is copied until json_str decodes a string into a buffer, which handles \n, \", \uXXXX and the surrogate pairs that emoji arrive as. Going the other way, quote escapes a C string into a JSON one for the request bodies, which are assembled with snprintf-style appends into a growable buffer.
It is not a JSON parser. It will accept things a parser would reject and it does no validation beyond what finding a key needs. It is also the reason nobody writes clients this way: the ninety lines are fine for a protocol with a dozen known keys, and they would be a liability the day the payloads got interesting. For this spec they are the cheapest code in the file.
libcurl hands you the body in pieces
The transport is the easy interface: one handle, a header list, CURLOPT_POSTFIELDS, and a write callback that libcurl calls with whatever the socket delivered. The callback is the SSE parser:
static size_t body(char *data, size_t size, size_t nmemb, void *userdata) {
turn *t = userdata;
size_t n = size * nmemb;
if (!t->status) curl_easy_getinfo(t->curl, CURLINFO_RESPONSE_CODE, &t->status);
if (t->status < 200 || t->status >= 300) { put(&t->error, data, n); return n; }
put(&t->line, data, n);
char *start = t->line.p, *nl;
while ((nl = memchr(start, '\n', t->line.n - (start - t->line.p)))) {
*nl = 0;
if (strncmp(start, "data: ", 6) == 0) event(t, start + 6);
start = nl + 1;
}
t->line.n -= start - t->line.p;
memmove(t->line.p, start, t->line.n + 1);
return n;
}
A chunk can end in the middle of a line, so the unfinished tail is kept and the next chunk is appended to it. Every complete data: line goes to event, which prints text deltas as they arrive with an fflush after each, accumulates the input_json_delta fragments for the tool, and notes the stop reason. The status code is read from the handle on the first callback, so a non-2xx body is collected rather than parsed as events, and error.message comes out of it afterwards with the same get.
One handle serves both requests, which is what keeps the connection open between the first reply and the second request. I had a line setting an empty Expect: header, from the memory of libcurl waiting for a 100 Continue on larger POSTs. The current rule is that it only does that above a megabyte, so the line came out.
The tool is fifteen lines, because libc has a timezone database
Rust and Zig had to read the TZif files under /usr/share/zoneinfo themselves to avoid spawning date. C's standard library has been reading them since before either language existed:
setenv("TZ", tz, 1);
tzset();
time_t now = time(NULL);
struct tm tm;
localtime_r(&now, &tm);
strftime(out, sizeof out, "%Y-%m-%dT%H:%M:%S%z", &tm);
The only work around it is checking that the zone the model asked for is a real file in that directory, because glibc falls back to UTC silently on a name it does not know, and a timezone tool that answers UTC for Europe/Londn is worse than one that says so. The turnaround column, which is where the tool runs, is 0.67 ms, a shade ahead of Rust's 0.73 and the best on the board.
Where the numbers land
| C | Rust | Zig | Go | C# Native AOT | bash and curl | |
|---|---|---|---|---|---|---|
| Artefact | 2.1 MB | 1.4 MB | 488 KB | 5.8 MB | 5.4 MB | 3.7 KB |
| Runtime | 0 | 2.0 MB | 0 | 0 | 2.4 MB | 23.7 MB |
| Ship | 2.1 MB | 3.3 MB | 488 KB | 5.8 MB | 7.8 MB | 23.7 MB |
| Cold start, median of 100 | 1.3 ms | 1.1 ms | 1.4 ms | 1.7 ms | 3.0 ms | 7.0 ms |
| Turnaround, median of 100 | 0.7 ms | 0.7 ms | 1.0 ms | 1.1 ms | 1.4 ms | 19.1 ms |
| Client total, median of 100 | 2.8 ms | 3.2 ms | 3.7 ms | 4.4 ms | 7.1 ms | 35.3 ms |
| Peak RSS | 6 MB | 3 MB | 2 MB | 6 MB | 7 MB | 12 MB |
| Lines of code | 271 | 184 | 179 | 156 | 102 | 75 |
| Third-party packages | 1 | 36 | 0 | 0 | 0 | 0 |
GCC 14.2, libcurl 8.23.0 built static with HTTP only, mbedTLS 3.6.6, linux/arm64, Apple M4 Max under Docker.
And the three builds of the same file, since they are the point of the post:
| apt-get libcurl, dynamic | static, OpenSSL | static, mbedTLS | |
|---|---|---|---|
| Artefact | 66 KB | 7.2 MB | 2.1 MB |
| Shared libraries | 32, 21.8 MB | 0 | 0 |
| Cold start | 3.6 ms | 2.0 ms | 1.3 ms |
| Turnaround | 0.7 ms | 0.7 ms | 0.7 ms |
| Tail, last byte to exit | 2.2 ms | 1.8 ms | 0.8 ms |
| Client total | 6.7 ms | 4.7 ms | 2.8 ms |
| Peak RSS | 12 MB | 6 MB | 6 MB |
Turnaround does not move, because the work between the two requests is the client's own code and it is the same code. Everything else is the library. The one column C does not win is lines: 271 against Rust's 184, and most of the difference is the JSON that serde wrote for Rust and I wrote for C. Zig keeps the size and memory columns, at a quarter of the binary and well under half the memory, because its standard library has a TLS client in it and mbedTLS, small as it is, is still a general-purpose one.
The third-party count is one, and the leaderboard has no column for how big that one is. The second table is that column.
How to run it
git clone https://github.com/AndyCross/claude-hot-path
cd claude-hot-path
./bench/bench.sh c
Docker and Python 3, no key. The build stage downloads the curl tarball and compiles the library, which makes it the slowest build in the series so far at just under a minute cold. Next is Python on the standard library alone, http.client and no requests, which is the post where the interpreter's start-up time is the whole story.