Warp: hot-path performance optimizations (+101% keep-alive throughput, -51% allocation)

Just randomly saw this PR to warp. Great use of AI to improve performance of core libraries in the haskell ecosystem

15 Likes

Is the PR description AI too? Nowadays I am always suspicious. But also can never quite tell (I’m bad at detecting it.)

AI code is whatever (especially for what warp is) but having to read AI descriptions of it is a bit much for me.

I would sooner ban AI PR descriptions than AI code lolol.

2 Likes

It’s awesome that the wai maintainers agreed to review this code.

What I noticed is that nothing in the original PR indicates whether the PR author himself understands the changes.

6 Likes

AI optimization PRs are insidious, aren’t they? here’s N%. why argue about code style or other concerns? it’s Faster now!

gradient descent is a dangerous drug. it can help but it can also get you stuck in a valley.

3 Likes

Like..I can point Claude at most popular Haskell libraries and prompt it with

Create benchmarks for various core functions and then unroll loops in their implementation so they are faster

and get infinite PRs that speed up code that many companies use. :money_mouth_face:

But should our ecosystem just be low level code of unrolled abstractions? Isn’t that antithesis to the whole reason we became Haskellers to begin with?

It’s troubling..

4 Likes

I think interesting questions are:

  • why did GHC not do those optimizations?
  • why did no one before find those hand-rolled optimizations?
  • why is human-driven performance debugging so cumbersome?

All those point to possible tooling improvements. It’s easy to complain about AI, but we have work to do if we want to make things fun for humans again.

14 Likes

Right, god forbid we get faster ubiquitous libraries, because gasp EVIL COMPANIES WILL BENEFIT!

Unbelievable :roll_eyes:

I for one am having a blast with LLM-assisted development :man_shrugging:

8 Likes

You seemed to focus in on this out of the context before and after it, so let me spell out my point more explicitly:

Performance optimization is often good but the real thing we are after is Quality for the end user. Performance is definitely easier to measure, which is kind of why it can tempt you off the Quality path. But Performance gains, even big ones in common libraries, can easily be barely impactful to the end user.

(As a P.S. I’d like to comment on how this is a fun full circle moment for me. Years ago when choosing an effects library, I chose cleff over effectual for precisely these reasons. Both your comments in the cleff “Advantages over effectful” issue and effectful’s API itself were a little too dripping in Performance Maximalism for my taste. In fact, your benchmark suite is what sold me on cleff’s Performance and made me feel confident using it over effectful for 60fps game logic!)

8 Likes

Not just you, seems others are having a blast on the GHC tracker too:

And the caveat:

This ticket reports a possible bug found by an LLM-based code review (details under “Provenance” below). I, @sjakobi, have checked it for plausibility, but not verified it in depth.

So I guess the actual work has to be done by others: triage, filter, review.

6 Likes

I think it’s perfectly fine to demand they do that first. Boundaries can be set here by placing the PRs on hold or even close them and ask them to come back once the human is fully convinced and can stand for the change.

I think this behavior falls under “Don’t be a meat proxy”. See Don't be a meat proxy

From a quick look at the Warp PR it’s a bit more unclear to me just how deeply the author understands the change. In the very quick glance I didn’t see any super obvious red flags (like the comment quoted above). I think more signals there can be gathered by asking e.g. “without using an LLM, could you tell me about the tradeoffs made in these PRs?”

That or some other open ended question. Those cost very little effort to ask, and the answers typically are a great source for green or red flags.

4 Likes

That’s not what they said and that’s not what I understood, either, why are you being so defensive?

6 Likes

I have not come across this term before I think its great. I’ve been “meat proxied” before and it can be a very frustrating experience.

I think the new skill people need to develop here is when it’s okay to be mostly a proxy, and when it’s time to just dump a prompt into a comment and call it a day.

3 Likes

But now they won’t even have the fun implementing the fun parts :worried: