Built for
absurd speed.

Elegance really is as fast as we say it is.

82,751req/s for a raw API route
4,592×faster on · 200K page
0.72 msavg latency · 200K page
198 Btransferred · 200K page

Proof, not promises.

01

200K Lines

200,000 mounted <p> elements
4,592×× requests/sec

This test is meant to stress-test how well both frameworks handle extremely large payloads; as well as how efficiently they scale up.

By creating a page with 200 thousand individual <p>Stress-Testing.</p> elements, we effectively scale up every miniscule bit of baggage both frameworks accumulate, exposing inefficiencies.

At first you may think that something is incorrect with the test data, and so did we. However, the byte size is actually correct. The page HTML is roughly 4.2Mb in size, but the out-of-the-box Brotli compression in elegance comresses it down to a couple hundred bytes transferred. Elegance also does not ship a VDOM, nor any other unneeded JavaScript. This page also contains no interactive elements, meaning our JS shipped was a mere few kilobytes.

For Next.JS, we were shocked to see that the actual page HTML generated by default was a stagerring 18.1 megabytes! We suspect this is because Next.JS by default includes a serialized VDOM of sorts, GZIP tries it's best, and to it's credit it actually shrinks the page HTML down to about a megabyte.

Developer Notes: On this machine, the page does build with Next.JS 16 - but Next's cache rejected the rendered page ("Single item size exceeds maxSize"), so every request re-renders the full 19 MB HTML, gzip compressing it on the fly.

We are also aware this is not hyper-realistic in terms of usage, but it's interesting to note, nevertheless.

metricEleganceNext.JSratio
Requests / sec68,877154,592× more
Average latency0.72 ms3.45 s4,758× lower
p99 latency1.49 ms3.85 s2,578× lower
Transferred / request198 B1.07 MB5,379× less
Success rate100.00%100.00%
200K Linesresults/200k-lines/test.md
// Elegance (pages/page.tsx) and Next.JS (app/page.tsx)
export default function page() {
    return <div>
        <h1>Stress-Testing.</h1>
        {/* ... 200 thousand more times ... */}
    </div>
}
02

Raw API RPS

one GET endpoint · identical payloads
25.8×× requests/sec

This test is meant to measure raw RPS (requests-per-second) by simulating a primitive GET endpoint that returns {"message": "Hello, World!", }.

Both frameworks return the exact same paylod, so the only factor which affects RPS is raw framework level overhead and optimizations.

metricEleganceNext.JSratio
Requests / sec82,7513,20725.8× more
Average latency0.60 ms15.59 ms25.8× lower
p99 latency1.20 ms24.11 ms20.1× lower
Transferred / request27 B27 Bidentical
Success rate100.00%100.00%
Raw API RPSresults/raw-rps-test/test.md
// Elegance: /pages/api/route.ts
import type { IncomingMessage, ServerResponse } from "node:http";

export async function GET(req: IncomingMessage, res: ServerResponse) {
    res.end(JSON.stringify({ message: "Hello, World!", }));
}

// Next.JS: /app/api/route.ts
export async function GET() {
    const res = new Response(JSON.stringify({ message: "Hello, World!", }));

    return res;
}
03

Hello World

minimal static page
17.8×× requests/sec

This test attempts to measure raw RPS (requests-per-second) with a minimal static page.

Elegance

  • Prod mode uses -prod flag
  • Dev mode uses -dev flag

Next.JS

  • Production mode test uses output: "standalone" in next.config.ts, and was executed with node .next/standalone/server.js.
metricEleganceNext.JSratio
Requests / sec66,6063,73317.8× more
Average latency0.75 ms13.39 ms17.9× lower
p99 latency1.58 ms21.22 ms13.4× lower
Transferred / request165 B1.5 KB8.9× less
Success rate100.00%100.00%
Hello Worldresults/hello-world/test.md
// Next.JS (app/page.tsx) & Elegance (pages/page.tsx)
export default function page() {
    return <div>
        <h1>Hello World!</h1>
    </div>
}
04

SSR Test

dynamic page · rendered per request
47.4×× requests/sec

This test aims to measure how fast both frameworks can render a dynamic server-rendered page.

For next, this involves force-dynamic to ensure the result isn't cached.

On both pages, we read some request headers, and embed them into the response.

metricEleganceNext.JSratio
Requests / sec36,88877747.4× more
Average latency1.35 ms64.38 ms47.5× lower
p99 latency2.95 ms77.73 ms26.4× lower
Transferred / request302 B1.8 KB5.9× less
Success rate100.00%100.00%
SSR Testresults/ssr-test/test.md
// Next.JS: /app/page.tsx
import { headers } from 'next/headers'

export const dynamic = 'force-dynamic'

export default async function page() {
    const h = await headers()
    const headerValue = h.get('accept-encoding');

    return <div>{headerValue}</div>
}

// Elegance: /pages/page.tsx
import type { IncomingMessage, } from "node:http";

export default function page({ req, }: { req: IncomingMessage }) {
    const headerValue = req.headers["accept-encoding"]; 

    return <div>{headerValue}</div>;
}

export const isDynamic = true;
05

Variance 10K

incompressible dynamic page · seeded PRNG
8.1×× requests/sec

This test is the incompressible counterpart to 200K Lines.

The 200K line test is the same element repeated, which let's compression take over. It's still an interesting test because of the boilerplate / compression settings, but regardless; more testing is required.

This test served 10K paragrahps of completely randomly generated words, with a random numeric suffix. This payload is more realistic, and way less compressible.

So in short, this measures raw render serialization, and transfer throughput.

The content is generated with a seeded PRNG (mulberry32, seed 1337) over a shared 64-word list, using identical generator code in both frameworks. This means:

  • Every request returns the same content.
  • Both frameworks render byte-identical paragraph content - all 10,000 entries checksum-match across frameworks. The full documents still differ in size, because Next.JS additionally embeds its serialized flight payload (see 200K Lines).

The page is rendered dynamically on every request (isDynamic = true / force-dynamic).

Resulting sizes: Elegance renders a 0.69 Mb HTML document (200 KB transferred over Brotli), Next.JS a 2.49 Mb document (592 KB transferred over GZIP).

Developer Notes: We originally ran this test with 50 thousand paragraphs (~12.5 Mb of HTML on both sides). Elegance completed the run (15.8 rps at -c 50), but Next.JS could not finish a single request inside the 30 second window, which in turn lead to all 50 connections being aborted at the deadline with zero completed responses.

We re-scaled to 10K so both frameworks produce comparable numbers.

On transfer sizes

Since the paragraph content is identical, differences in Bytes / request come from each framework's out-of-the-box compression defaults (Elegance ships Brotli, Next.JS ships GZIP) and from the flight payload Next.JS appends. On incompressible content Brotli still maintains a large lead over GZIP, which is exactly what makes this comparison interesting.

metricEleganceNext.JSratio
Requests / sec79108.1× more
Average latency636.06 ms5.64 s8.9× lower
p99 latency4.52 s9.70 s2.1× lower
Transferred / request200.8 KB592.6 KB3.0× less
Success rate100.00%100.00%
Variance 10Kresults/variance-10k/test.md
// Elegance (pages/page.tsx) & Next.JS (app/page.tsx)
function mulberry32(a: number) {
    return function () {
        a |= 0; a = (a + 0x6D2B79F5) | 0;
        let t = Math.imul(a ^ (a >>> 15), 1 | a);
        t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
        return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
    };
}

export default function Page() {
    const rand = mulberry32(1337);
    const paras: string[] = [];
    
    for (let i = 0; i < 10000; i++) {
        let s = "";
        
        for (let w = 0; w < 8; w++) {
            s += (w ? " " : "") + WORDS[Math.floor(rand() * WORDS.length)];
        }
    
        s += " #" + Math.floor(rand() * 1000000);
        
        paras.push(s);
    }

    return <div>
        <h1>Variance Testing.</h1>

        {paras.map(p => <p>{p}</p>)}
    </div>;
}

// Elegance: export const isDynamic = true;
// Next.JS: export const dynamic = 'force-dynamic'
06

Middleware Overhead

raw API endpoint · one no-op middleware
33.9×× requests/sec

This test measures the cost of passing every request through a middleware layer.

The endpoint is identical to the one in the Raw API RPS test - a GET returning {"message": "Hello, World!"} - except a global middleware runs before it and attaches a single response header (x-bench-middleware: 1).

metricEleganceNext.JSratio
Requests / sec79,9632,35933.9× more
Average latency0.62 ms21.20 ms34.0× lower
p99 latency1.39 ms31.95 ms23.0× lower
Transferred / request27 B27 Bidentical
Success rate100.00%100.00%
Middleware Overheadresults/middleware-test/test.md
// Elegance: /pages/middleware.ts
import type { IncomingMessage, ServerResponse } from "node:http";

export default async function middleware(
    req: IncomingMessage,
    res: ServerResponse,
    next: () => Promise<void>,
) {
    res.setHeader("x-bench-middleware", "1");

    await next();
}
// Next.JS: /proxy.ts  (Next 16)
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function proxy(req: NextRequest) {
    const res = NextResponse.next();
    
    res.headers.set("x-bench-middleware", "1");
    
    return res;
}

export const config = {
    matcher: "/api/:path*",
};

How we measured it.

All tests were run on a machine running with:

  • CachyOS Linux (Arch-based, rolling) x86_64
  • Linux 7.2.0-1-cachyos
  • Hyprland (Wayland)
  • AMD Ryzen 7 255 (8 cores / 16 threads) @ up to 4.97 GHz boost
  • 16 GB RAM
  • Node v26.7.0
  • Next.JS 16.1.6 (Turbopack, standalone output)
  • elegance-js 3.2.0 (local build)

oha (v1.16.0) is used for the actual stress-testing tool.

Two of the tests deserve a note on fairness: the Variance 10K page generates its content with a seeded PRNG (mulberry32, seed 1337) over a shared 64-word list, using identical generator code in both frameworks - so both render byte-identical paragraph content on every request, and the payload is incompressible by construction. The Middleware test uses an endpoint identical to the Raw API RPS test with one no-op global middleware attached; read its numbers against the Raw API RPS card for the per-request middleware overhead. For Next.JS this uses the proxy.ts convention (Next 16's replacement for middleware.ts), for Elegance pages/middleware.ts.

To ensure performance and memory availability was fair, each server was freshly started for its run - and we stopped each server before we tested the other one. The machine was plugged in with the CPU governor and EPP set to performance for every run.

It's also important to note, that whilst Elegance by default uses all available threads in production mode, we used only 1 worker (-w=1), as most test results scale linearly with worker count; and this way it's more comparable to the Next server.

For all tests, we ran -c 50 -z 10 for warmup, and -c 50 -z 30 for the actual test.

Download the
full results.

Everything: the oha JSON summaries, per-test writeups, the methodology, and a small viewer script so you can browse the numbers yourself!

archive contentstesting.zip
testing.zip
├── methodology.md
├── view-results.js
└── results/
│   ├── 200k-lines/
│   │   ├── test.md
│   │   ├── elegance-production-mode.json
│   │   └── next-production-mode.json
│   ├── raw-rps-test/
│   │   ├── test.md
│   │   ├── elegance-production-mode.json
│   │   └── next-production-mode.json
│   ├── hello-world/
│   │   ├── test.md
│   │   ├── elegance-production-mode.json
│   │   └── next-production-mode.json
│   ├── ssr-test/
│   │   ├── test.md
│   │   ├── elegance-run-5.json
│   │   └── next-run-5.json
│   ├── variance-10k/
│   │   ├── test.md
│   │   ├── elegance-production-mode.json
│   │   └── next-production-mode.json
    └── middleware-test/
        ├── test.md
        ├── elegance-production-mode.json
        └── next-production-mode.json