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

12 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.

1 Like

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.

3 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.

1 Like

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..

1 Like

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.

9 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:

6 Likes

You seemed to focus in on this out of its 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!)

4 Likes