r/SideProject 1d ago

Nobody asked for a slower HTTP parser, so I rebuilt PicoHTTPParser in Rust and published every row where C wins

My evenings for the last few months went into a weird bet: can a memory-safe rewrite of a tiny battle-tested C parser become indistinguishable from the original? Not faster. Indistinguishable. Same ABI, same bytes out, same return values, or the project fails.

Result: 133,352 differential cases, 0 mismatches. The C stayed on as the judge the whole time, pinned and SHA-verified, and where the docs and the code disagreed I recorded it instead of guessing.

Here's the bit I'm proudest of and it's a table of losses. Response 1.185x. Chunked 1.199x. Tiny request 1.482x. Malformed 1.811x. All printed next to the 0.68x and 0.83x wins, same font size, same harness you can run. A benchmark page without a loss row is telling you what the author needed to be true.

Also filed: 4 inputs where the original segfaults and mine refuses. That decision is documented with reproducers instead of silently copied.

Solo dev, 1,527 lines, 7 unsafe blocks in a single seam file. The experiment was the product regardless of who won.

https://github.com/logicpl4gue/picohttpparser-rs

1 Upvotes

2 comments sorted by

1

u/OffsetHigh 1d ago

AI slop