Gabriele Ferreri’s Post

A JavaScript framework uses eval() in production — and handles 2.4 million requests per second. That's 21× faster than Express. The framework is Elysia. It ships with a JIT "compiler" that's been running in production for 3 years. Here's what it does: ❌ Traditional frameworks parse everything: function centralHandler(request) {  const body = await parseBody(request)  const query = parseQuery(request.url)  const headers = parseHeaders(request.headers)  return routeHandler({ body, query, headers }) } Every route pays the cost of parsing body, query, AND headers — even if the handler only reads params. The mechanism: Elysia's "Sucrose" module reads your handler's source code via Function.toString() at startup. It detects which parts of the request your handler actually uses, then generates a tailored function using new Function() that only parses what's needed. ✅ Elysia generates route-specific code: function tailoredHandler(request) {  const params = parseParams(request.url)  return routeHandler({ request, params }) } No body parsing. No query parsing. No header parsing. Just params — because that's all the handler touches. This is the same pattern ajv (895M downloads/month) and TypeBox (332M downloads/month) have used for years. Elysia just scales it from validation to an entire web framework. The numbers from TechEmpower Round 22: • Elysia (Bun): 2,454,631 req/s • Fastify (Node): 415,600 req/s • Express (Node): 113,117 req/s When this doesn't apply: • If your routes are dynamic or heavily middleware-dependent, the JIT gains shrink • For serverless (cold starts), the <0.005ms compilation overhead per route still matters at scale • If your team has strict CSP policies banning eval(), you'll need aot: false mode (which disables the compiler) Elysia published a peer-reviewed paper on this approach in the ACM Digital Library (2024), and it ranks #14 on TechEmpower's global framework benchmarks. What's the most controversial optimization you've shipped in production? #JavaScript #WebDev #BackendDevelopment #Performance #Bun

  • No alternative text description for this image

it's really cool , we use elysia for our backend and it's super fast and easy to use.

Like
Reply

I'm definitely gonna use it for my next 100-users-per-day project. You never know. Today it’s 100 per day; tomorrow it’s 2M per second. Gotta be ready for the big success, man.

Like
Reply

Who prepared the comparison? Did he use complete business logic to handle user request?

Like
Reply

The comparison is actually very unfair, isn't it? Why would someone compare frameworks using different runtimes? That doesn't make any sense.

Like
Reply

Curious how much this helps in real apps where middleware does most of the work. If middleware already reads body/query/headers, does the optimization still provide meaningful gains?

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories