54 points · by saltyaom · 9mo ago · 10 comments
Basically, there's a JIT "compiler" embedded into a framework
This approach has been used by ajv and TypeBox before for input validation, making it faster than other competitors
Elysia basically does the same, but scales that into a full backend framework
This gave Elysia an unfair advantage in the performance game, making Elysia the fastest framework on Bun runtime, but also faster than most on Node, Deno, and Cloudflare Worker as well, when using the same underlying HTTP adapter
There is an escape hatch if necessary, but for the past 3 years, there have been no critical reports about the JIT "compiler"
What do you think?
So my question is whether there are any real-world scenarios where the performance gains will make a difference to the end customer? Because if not, this framework would bring on the known downsides without a compelling reason for doing so aside from bragging rights of "we're the fastest"
My understanding is that just offering a request object with lazy accessors would solve this issue, although the accessor itself would have some overhead in repeat accesses.
> Elysia has two special optimizations for response mapping functions: mapResponse and mapCompactResponse.
This section feels a bit abstract - some transformation examples would be nice.
The overhead can be reduced with caching. Frameworks like Java Vertx (used by Quarkus) already do it this way?
My site https://c50.fingswotidun.com/ uses the same trick to generate code for the image generation.
Between the confusion of what Compile, JIT, Engine, Runtime, and FrameWork is (which I blame Bun a little bit for starting this entire Runtime/Engine confusion). I think we might need some new terminology to describe this method.
Maybe a made-up word is needed, JIT was good in that an acronym with a vowel made it wordable and specific.
Hmm.
const app = new Elysia() .patch('/user/:id', (request) => { return handleUserRequest(request); })
or some other custom logic, does it automatically need to fall back to full parsing?