The AI cost of JavaScript frameworks: a benchmark reveals the real price

Nolan Lawson built the same Pokémon app five times with twelve different JavaScript frameworks, using Claude Code agents, to measure what each framework actually costs in AI-assisted development. He tracked API cost, wall-clock time, token usage, and Lighthouse scores. The results show Hono+htmx and Astro are cheapest, while SvelteKit, Gracile+Lit, and Angular are most expensive. But the variance is huge, and the author admits the experiment is stochastic and imperfect. Still, it's a rare evidence-based look at which frameworks work best with AI agents.
Whenever I read one of these accounts, I think to myself, “Where are the benchmarks?” Well I got curious, so I wrote a benchmark.
- puelocesar
> One of my pet peeves with the web development community is that so many of the decisions we make are vibes-based. ... All of this breathless boasting is usually offered with zero evidence
AI aside, this is something that bothered me a lot when I was forced to migrate from pure native mobile (swift) to React Native.
People would take the promotional talk of some SDK as truth without ever measuring and then being confused on why the whole app was slow (it CANNOT be XYZ, because XYZ developer says the are super fast!!)
Luckily my team was able to accept when I provided hard data (said framework was locking the JS thread for 200ms, sometimes a full second, for some operations, which rendered the all the UI laggy as hell).
- jvanveen
Besides a rewrite to another framework using AI, another option is to modernize the framework with AI instead. Personally, I started to like Mithril after having worked with it for a few years. Instead of rewriting it to a better maintained alternative (mithril doesn't have much active development going on since 2015), I used agents to add signals, proper state management, typing, ssr, computed properties, Bun tooling and more to it. Thanks to the existing test suite, changes landed quite reliably. Source: https://code.garage44.eu/jeroen/mithril
- jillesvangurp
AI cost of using anything is a good yard stick to measure things by. Red flags are a high degree of verbosity in tool outputs, complex failure modes, and slow running tools. Basically all that results in AIs having to look and dig through more output (tokens) and spend a lot of time polling tools for readiness (more tokens). The more complex a build for something is, the worse it gets. Especially if you also include things like running tests, linters, and all the rest. It adds up quickly when AI reasoning is causing a lot of trial and error to happen. It will eventually figure it out. But it might not be cheap.
Cost of iteration in time and tokens is really important if you like moving quickly without having to boil the oceans for simple changes. That was always true but AI kind of magnifies it because it's doing a lot of heavy lifting. Most of the time you wait for AI tools, you are actually waiting for tool calls to happen.
At this point just optimizing for all that could save you a lot of time and tokens. Which is really nice for your wallet and maintaining some flow state. I've stopped obsessing about my own biases in tools, frameworks, and programming languages. That made a lot of sense when I was the primary user of that stuff. But I'm not anymore. I might glance at the code to see if it's roughly doing what I expect. But there's too much of it for a detailed reviews and nit picking on my side. If I feel strongly about something, I'll ask for a change. But if it works, […]
- neya
This benchmark is too simplified to be meaningful. The choice of a framework is rarely based on speed alone, it factors in other elements like the user's domain knowledge, long term maintainability and the framework's track record itself w.r.t security and development of features.
In this regard alone, it will make a lot of sense to spend extra $2 and 2 mins to trade off for a long-term maintainable codebase and code you can reason about than just something made quickly just to get it deployed fast.
In my personal use case, that would be Svelte 5 for me and I'm sure it will be something else for everyone.
- tancop
Astro comes out on top with the best time, #2 lowest spend and zero client side JS. I know what I'm using for my next project.
- austin-cheney
The are some very real costs to JavaScript frameworks. These frameworks do not exist to empower developers. They exist to:
* so that employers do not have to invest in training developers.
* to ease candidate selection at hiring, which greases the wheels of hiring/firing
In the big corporate world, especially at non-software companies, there is a culture that strongly believes internally written software sucks. This is Invented Here syndrome, and it reflects that internal developers cannot write software and employers will not invest in maintenance.
The larger costs there are human costs, the inability to efficiently solve any problem outside the constraints imposed by the framework.
- jatins
I guess the conclusion is Angular was the worst choice pre AI and continues to be post AI
- unsloppable
HTMX is interesting.
I have most of my apps in it without much trouble.
One of my recent ones had a very complicated form and state management.
AI really struggled with HTMX in that use case.
Like the form might work but the page would take 30s to load. Or some state would randomly drop or a toggle wouldn't work after changing a dependency.
If I rewrote that in react it would have one shot it without a doubt. Some things are just better models for different problems.
For the record I eventually got enough tests in place to keep the agent honest and the HTMX version is now a lot faster anything I could have got out of react but yeah, it was an adventure.
- deepsun
IMO the largest true value of the frameworks (and languages to some extent) is how they help long-running projects with many people coming and going. The most valuable trait was not what framework allowed, but what framework disallowed, preventing foot guns. E.g. Java got popular because it forced everyone to code similarly, at least more similar than other languages at that time.
But for agents it doesn't matter, so why frameworks at all?
PS: authors comparison is not relevant, as it's simple mostly-static app with very little cross-dependencies, localizations, component re-usage.
- ramigb
I just used Astro yesterday for a static website I am deploying to cloudflare pages. I must say I was really impressed by the whole experience! From claude being super fast and diligent to the site structure being “decent” for the tokens and effort spent on it.
If anyone interested here is the source code all done by Opus 5.5