logoalt Hacker News

etermtoday at 12:42 PM1 replyview on HN

I did something similar recently with Google's C# protobuf library. I had spotted I was getting CPU bound rather than memory bandwidth bound when doing streaming of uint32 buffers in dotnet gRPC.

I then asked claude to compare the C#/.NET implementation in the library with the C++ version, and it quickly identified that the C# library was missing a couple of fairly cheap optimisations that were present in the C++ version.

If I can help get a PR merged, then it'll be by far the biggest impact of any work I've ever done.

I also compared the Rust version, it had this specific optimisation. The far more popular Tokio/Prost library did not.

Given appropriate guardrails, LLMs are impossibly fast at iterating to find root causes and specific performance bottlenecks.


Replies

Almondsetattoday at 12:59 PM

You presented another thing LLMs excel at: integrating something from a project that is not present in another one. I think they work so well at this because both the starting and ending points have an already existing structure, so the LLM can guide itself effectively. In your case it's even more egregious because we are talking about the same exact algorithm/functionality implemented in two different, but rather similar, programming languages.

Could you have manually profiled and compared the execution paths? Sure. Could you have translated the C++ optimizations to C#? Sure. But in such an obvious case, the LLM managed itself.