I'm between jobs right now, and I'm bad at sitting idle. I could have built yet another portfolio site with a chatbot and a smiling robot avatar, but I wanted to spend the time on something people might actually use.
There was a second reason. My feed is full of stories about LLM agents that burn thousands of dollars in tokens overnight. I suspected that most of them say more about the process than about the tools, and I wanted to check that on real work.
So over about three weeks, with Claude Code on a $20/month Pro plan as the main tool (plus $100 of promotional credits that were expiring anyway, and some free-tier model sessions for the routine parts), I ported four native libraries to fully managed C#, with no P/Invoke and no native binaries:
- Leptonica.Managed - Leptonica 1.87.0, image processing and the base of Tesseract OCR; about 2,700 functions. https://github.com/sensboston/Leptonica.Managed - Stb.Managed - seven of Sean Barrett's stb libraries (image load/save, resize, TrueType, rect_pack, DXT, Perlin). https://github.com/sensboston/Stb.Managed - MetadataSharp - EXIF/MakerNotes, IPTC, XMP and ICC read/write. Not a port: written from the specs, with Exiv2 as the reference. https://github.com/sensboston/MetadataSharp - MdfLibrary.Managed - mdflib, the ASAM MDF format of automotive data loggers, with the same API as its Windows-only C++/CLI wrapper, plus a cross-platform viewer with live CAN capture. https://github.com/sensboston/mdflib.net
All four are on NuGet under MIT.
I wouldn't call this vibe coding. The model wrote most of the code, but the work went the way any port of this size should go, with or without an LLM. First we discussed the architecture: what maps to what in C#, what stays bit-exact and what may be optimized, what is ported and what is left out. Then came a written plan in stages, each with a measurable exit condition. Before the first line of the port, the native library was built and became the oracle; the tests compare against it, not against the model's opinion of what the output should be. Then the work went in small batches, each merged only when CI was green.
The checks are boring on purpose: pixel by pixel against Leptonica's golden files, byte by byte against stb, tag by tag against exiv2 on its own test corpus, file by file against the native MdfLibrary. Parsers are fuzzed. It still isn't bulletproof: the GPU path of Stb.Managed passed every test on ILGPU's CPU accelerator and did not work at all on a real CUDA card. Tests are only as honest as the hardware they run on.
One result surprised me: the managed code is faster than C on most operations - about 1.3-2.0x single-threaded for Leptonica (regular Release build of the C library) and 1.5-1.8x for stb (-O3 -march=native). The JIT emits Vector128/256/512 code for the actual CPU, and Leptonica's C code has almost no SIMD. It is not faster everywhere: stb's hand-written SIMD resize still wins on one core, and JPEG on ARM64 is slower. The slow cases are listed in each repo.
Total extra cost beyond the subscription: $0. The expensive part was waiting for usage limits to reset; my patience turned out to be the scarcest resource in the project.
Happy to answer questions about the process, the verification, or the parts that went wrong.
Comments URL: https://news.ycombinator.com/item?id=50635452
Points: 1
# Comments: 0
