Skip to content

Router Benchmark ​

How fast can each router match a URL to a handler and pull out parameters? This benchmark isolates just the routing layer — no HTTP, no middleware, just pure matching.

Full source code: prostojs/router-benchmark

Routers Tested ​

RouterUsed byType
@prostojs/routerWooksRegex-based, indexed
find-my-wayFastifyRadix trie
rou3h3 / NitroRadix trie
Hono RegExpRouterHonoCompiled RegExp (falls back to TrieRouter on complex sets)
ExpressExpressLinear scan (baseline)

Methodology ​

Each router registers the same set of routes and resolves the same request mix. Importantly, every benchmark forces full parameter extraction — not just matching — so routers that defer param processing don't get an unfair advantage.

The tests cover three route shapes: short paths (2–5 segments), long paths (5–10 segments), and a mixed 50/50 combination. The workload includes statics, parametric routes with up to 4 params, wildcards, multiple HTTP methods, and 404 misses.

Results are in operations per millisecond — higher is better.

Overview by Route Type ​

Key takeaway

ProstoRouter leads on long, enterprise-style routes while staying competitive on short ones. Hono's RegExpRouter is fastest on short and mixed patterns — but as the scaling section reveals, its compiled regex approach breaks down on larger route sets.

Short Routes (22 routes) ​

Typical REST APIs with 2–5 segment paths.

Hono's RegExpRouter and ProstoRouter are neck-and-neck here — both far ahead of the trie-based routers. The compiled regex approach excels on compact route sets.

Long Routes (22 routes) ​

The kind of deep, nested paths you'd see in a real SaaS API — 5–10 segments with shared prefixes and multiple parameters. Think /api/v1/orgs/:orgId/teams/:teamId/projects/:projectId/tasks/:taskId.

ProstoRouter leads here — comfortably ahead of every other router. These are the route patterns that real SaaS APIs actually use, and ProstoRouter handles them best.

Mixed Routes (20 routes) ​

50/50 combination of short and long routes.

Hono's RegExpRouter leads here thanks to its strong short-route performance. ProstoRouter and Rou3 are close behind.

Long Route Breakdown ​

A closer look at individual long-route test patterns — this is where router architectures reveal their strengths and weaknesses:

Static lookups: Rou3 dominates pure static resolution thanks to its radix trie optimized for exact matches. Hono comes second. ProstoRouter's regex-based approach trades some static-lookup speed for richer pattern support — still very fast.

Parametric routes: ProstoRouter leads across all parameter counts. The more params a route has, the bigger the gap — ProstoRouter's advantage grows with complexity.

POST/PUT/DELETE with params: ProstoRouter and Hono are essentially tied, both ahead of Rou3 and find-my-way.

404 handling: Hono's RegExpRouter excels at rejecting non-matching URIs — its compiled regex rejects in one step. The other routers handle 404s reasonably well, with find-my-way slightly ahead of ProstoRouter and Rou3.

Scaling: 22 → 200 Routes ​

Small benchmarks can be deceiving. A router that tops the chart with a handful of routes may not hold up when your application grows. This scaling benchmark reveals what happens as route tables reach real-world sizes.

Short Routes ​

Long Routes ​

Mixed Routes ​

Hono's RegExpRouter hits a wall

Hono's RegExpRouter — the fastest router on small benchmarks — fails to compile its regular expression when route sets grow complex. On long routes beyond 100, and mixed routes beyond 198, Hono silently falls back to its much slower TrieRouter — becoming the slowest non-Express router in the field.

This is the most revealing part of the benchmark. The routers that look fastest in small tests tell a different story at scale:

RouterScaling behavior
ProstoRouterGradual, predictable slowdown (~2x from 22→200 routes)
HonoHits a cliff — falls back to TrieRouter and drops sharply
Rou3Nearly flat — trie structure handles growth well
find-my-wayNearly flat — same trie advantage

ProstoRouter stays fastest through 50 routes across all three route shapes, and remains competitive at 100–200. The trie-based routers (Rou3, find-my-way) degrade less because their structure inherently shares prefix storage — but they start from a lower baseline on parametric routes.

At larger scales, the order reshuffles — find-my-way's stable trie pulls ahead on mixed routes, while ProstoRouter still beats Rou3 and Hono's fallback TrieRouter. A router's architecture matters more than its microbenchmark peak.

Feature Comparison ​

Raw speed is only part of the picture. @prostojs/router supports features that trie-based routers can't:

Feature@prostojs/routerfind-my-wayRou3Hono
Parametric routes✅✅✅✅
Regex constraints on params✅✅❌❌
Multiple wildcards per path✅❌❌❌
Regex constraints on wildcards✅❌❌❌
Optional parameters✅❌❌✅
Case-insensitive matching✅✅❌❌
Trailing slash normalization✅❌❌❌
URL decoding✅✅❌❌
Same-name param arrays✅❌❌❌

@prostojs/router delivers the richest feature set while being the fastest on the route patterns that matter most in production — deeply-nested, parametric paths with multiple parameters.


Benchmark source: prostojs/router-benchmark. Results generated Feb 2026.

Released under the MIT License.