6-Way AI Coding Showdown: Framework vs No-Framework Across PHP, Go, and Rust
After publishing our Laravel Rust vs Laravel Go vs Laravel PHP runtime benchmarks, one comment kept popping up across X and YouTube: "Why do you even need a framework in Go or Rust anymore? Just let an AI write Pure Go
After publishing our Laravel Rust vs Laravel Go vs Laravel PHP runtime benchmarks, one comment kept popping up across X and YouTube:
"Why do you even need a framework in Go or Rust anymore? Just let an AI write Pure Go (
net/http) or Pure Rust (axum). Frameworks are dead in the AI era."
It is a fair question — and one nobody seems to have actually measured under controlled conditions. Most debates about "Framework vs No-Framework with AI" rely on vibes, tiny "Hello World" demos, or letting the AI grade its own homework.
So we built a strictly controlled, memory-zero, 6-way AI coding benchmark covering 3 languages × Framework vs No-Framework:
| Language | With Framework | Without Framework ("Pure") |
|---|---|---|
| PHP |
Laravel PHP (v13 + Laravel Boost) |
Pure PHP (PDO SQLite + PHPUnit) |
| Go |
Laravel Go v0.2.0 (go.laravel.com) |
Pure Go (net/http + modernc.org/sqlite) |
| Rust |
Laravel Rust 0.2.0 (laravel-rust) |
Pure Rust (axum + sqlx + serde) |
What came back surprised us — because both sides of the internet argument turned out to be right, for completely different reasons.
1. Experimental Setup: Making the Benchmark Airtight
If you run AI coding benchmarks casually, subtle biases ruin the data: cached memories from previous runs, package download speeds skewing wall-clock time, or the AI writing weak tests that always pass. We eliminated every single one of those variables:
-
Fixed Model & Reasoning Effort: Every run used
codex-cli 0.172.0pinned togpt-6-astrawithmodel_reasoning_effort = "medium". -
Cold-Start, Zero-Memory Isolation (
CODEX_HOME): Before each stack started, our harness created a brand-new disposableTMP_CODEX_HOMEdirectory containing onlyauth.jsonand a 2-lineconfig.toml. Nomemories/, nosessions/, nohistory.jsonl, no personalAGENTS.md, no globalskills/, and nohooks.json. As soon as a stack finished, the process exited andTMP_CODEX_HOMEwas deleted. -
Sequential Execution (Zero CPU Contention): All 6 stacks ran one after another on the same Apple M4 Max so
cargoorgo testnever competed for CPU cores. - Pre-Warmed Dependencies: Composer packages, Go modules, and Cargo crates were downloaded and pre-compiled before the timer started so network jitter never affected wall time.
-
100% Identical, Neutral Prompt (
SPEC.md): Every stack received the exact same specification with zero hints about Laravel Boost,artisan, or CLI generators. If a framework provided AI aids (like Laravel Boost inlaravel-phpor starter docs inlaravel-go/laravel-rust), Codex had to discover and use them autonomously. -
Independent 12-Point External Black-Box HTTP Contract Test: We did not trust Codex's own test suite alone. After each run finished, we booted every app as a live HTTP server on a fresh SQLite database and ran the exact same external Python HTTP verifier (
verify_http.py) against all 6 live servers.
The Task: A Real-World Invoice Management API
Not a toy counter — a real business mini-app with 2 relational tables (invoices + invoice_items) and 5 endpoints:
-
POST /api/invoices— Nested line items, strict validation (422with{ "errors": { ... } }), uniqueinvoice_number, server-computedtotal_centsinside a DB transaction (201). -
GET /api/invoices—statusfilter, case-insensitiveqsearch (invoice_number/customer_name),page&per_pagepagination with{ "data": [...], "meta": { "page", "per_page", "total" } },id DESC, avoiding N+1 queries. -
GET /api/invoices/{id}— Single invoice with nesteditems(200), or404when missing. -
POST /api/invoices/{id}/transition— Strict state machine (draft → sent/void,sent → paid/void,paidandvoidterminal). Invalid transitions must return422and leave the DB untouched. -
GET /api/invoices/export.csv— Samestatus/qfilters,text/csv; charset=utf-8,Content-Disposition: attachment; filename="invoices.csv", proper CSV escaping for commas like"Acme, Inc.". - Automated Feature Tests: At least 8 required integration/feature test cases, all passing with 0 failures.
2. Full 6-Way Results Table
Every single stack completed the task with exit_code = 0, passed its own linter/test suite (pint, go vet, go test -race, cargo clippy), and passed 12/12 external black-box HTTP contract tests on the first run:
| Stack | Wall Time | Cmds (Failed) | Input Tokens (Cached) | Output Tokens | Invoice App LOC | App Files | Self Tests | External Black-Box |
|---|---|---|---|---|---|---|---|---|
| Pure PHP (PDO) | 209.4 s | 6 (1) | 157,671 (145,920) | 9,422 | 272 | 4 | 47 pass | 12/12 PASS |
Pure Go (net/http) |
233.8 s | 10 (1) | 307,912 (285,440) | 9,677 | 476 | 2 | 12 pass | 12/12 PASS |
Pure Rust (axum) |
236.9 s | 6 (1) | 266,773 (242,048) | 9,888 | 478 | 3 | 12 pass | 12/12 PASS |
Laravel Go v0.2.0 |
241.4 s | 19 (5) | 1,121,265 (1,064,576) | 8,871 | 301 (-37%) | 9 | 13 pass | 12/12 PASS |
| Laravel PHP (+Boost) | 255.8 s | 13 (4) | 626,564 (567,040) | 10,678 | 391 | 13 | 65 pass | 12/12 PASS |
Laravel Rust 0.2.0 |
256.9 s | 19 (5) | 1,340,789 (1,269,632) | 8,462 | 238 (-50%) | 9 | 14 pass | 12/12 PASS |
(Note: "Invoice App LOC" counts non-empty lines in invoice-related application source files, excluding vendor/target/tests and untouched starter boilerplate.)
3. Shock #1: No-Framework Won Speed, Retries, AND Input Tokens
If you had bet that a framework would make AI finish faster on a single feature, you would have lost that bet:
-
All 3 "Pure" stacks finished faster than all 3 Laravel stacks: Pure PHP (
209.4s), Pure Go (233.8s), Pure Rust (236.9s) vs Laravel Go (241.4s), Laravel PHP (255.8s), Laravel Rust (256.9s). -
3.6× to 5.0× fewer input tokens:
- Pure PHP used 157,671 input tokens vs Laravel PHP's 626,564 (4.0×).
- Pure Go used 307,912 vs Laravel Go's 1,121,265 (3.6×).
- Pure Rust used 266,773 vs Laravel Rust's 1,340,789 (5.0×).
- Only 1 failed shell command per Pure stack vs 4–5 failed commands per Laravel stack.
Why did that happen? Look inside the Codex event logs:
-
Pretraining familiarity is a superpower:
gpt-6-astraknows PHPPDO, Gonet/http, and Rustaxum/sqlxcold. Inpure-php,pure-go, andpure-rust, there was almost nothing to read — Codex went straight to writing files and hit zero API surprises. -
Brand-new
v0.2.0frameworks incur a doc-reading tax: Because Laravel Gov0.2.0and Laravel Rust0.2.0were released this week, Codex did not have their exact APIs memorized. It spent extra commands grepping[email protected]/docs/and thelaravel-rustcrate docs to verify exact method signatures, racking up 1.1M–1.34M input tokens (though >94% were prompt-cached). -
Laravel Boost actually worked — and added upfront context: Even without any hint in the prompt, Codex in
laravel-phpautonomously discovered.agents/skills/laravel-best-practices/installed by Laravel Boost, read the guidelines, and then wrote an astonishing 65 feature tests (400 assertions) following Laravel's full MVC structure.
4. Shock #2: Frameworks Cut Application Code by Up to 50%
Now flip the table and look at how much application code Codex actually had to write — and the output tokens it generated:
-
Laravel Rust
0.2.0wrote just 238 LOC — the smallest application footprint of all 6 stacks, literally 50% less code than Pure Rust (478 LOC), and the lowest output tokens (8,462) of all 6 runs! -
Laravel Go
v0.2.0wrote 301 LOC — 37% less code than Pure Go (476 LOC), and the 2nd-lowest output tokens (8,871)! -
Pure Go (476 LOC in 2 files) and Pure Rust (478 LOC in 3 files) had to hand-roll everything from scratch inside monolithic files: routing, SQLite schema init, email/date validation, nested item loops,
422JSON builders, dynamicWHEREclauses, and test harnesses.
5. The Hidden Difference: API Contract Consistency
Look at the exact HTTP 422 response returned by our external black-box test 04_duplicate_number_422 across all 6 live servers:
-
Laravel PHP:
{"message":"The invoice number has already been taken.","errors":{"invoice_number":["The invoice number has already been taken."]}} -
Laravel Go
v0.2.0:{"message":"The invoice number has already been taken.","errors":{"invoice_number":["The invoice number has already been taken."]}} -
Laravel Rust
0.2.0:{"message":"The invoice number has already been taken.","errors":{"invoice_number":["The invoice number has already been taken."]}}
Byte-for-byte identical across PHP, Go, and Rust!
Now look at the 3 No-Framework ("Pure") servers:
-
Pure PHP:
{"errors":{"invoice_number":["This invoice number is already in use."]}} -
Pure Go:
{"errors":{"invoice_number":["has already been taken"]}} -
Pure Rust:
{"errors":{"invoice_number":["This invoice number is already in use"]}}
On Feature #1, hand-rolling feels fast and clean. On Feature #25, when a new developer (or a fresh memory-zero AI session) adds Orders, Refunds, Auth, Roles, Audit Logs, and Queues, every ad-hoc pattern drifts unless you accidentally build your own undocumented mini-framework.
6. The Honest Verdict
- Skip the framework (Pure PHP / Pure Go / Pure Rust) when building a 1–3 endpoint microservice, webhook receiver, or CLI tool — you get 10–20% faster generation and 3.6×–5× fewer input tokens.
- Use a framework (Laravel PHP / Laravel Go / Laravel Rust) when building a real business application with 10–100+ endpoints — the doc-reading cost is paid once, while 37–50% less application code per feature and byte-for-byte consistent API contracts compound on every feature you ship.
What has your experience been with AI coding agents — Team Framework or Team Pure? Drop a comment below!
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.