Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed test: express vs fastify #1181

Open
SonderRill opened this issue Jan 9, 2025 · 1 comment
Open

Speed test: express vs fastify #1181

SonderRill opened this issue Jan 9, 2025 · 1 comment

Comments

@SonderRill
Copy link

Bro, Hi. I won't give reproducible code examples, but it seems fastify and express work the same. I'll write the sequence of actions I did. They are very simple.

npx nestia template my-project

then i installed fastifty

npm i --save @nestjs/platform-fastify

and connected it to NestFactory

    this.application_ = await NestFactory.create(
      MyModule,
      new FastifyAdapter({ logger: true }),
    );

I tested a regular post request
image

the results are as follows

nestia + fastify
image

nestia + express
image

after installing http2 the protocol didn't change, but the speed only became slower :(

    this.application_ = await NestFactory.create(
      MyModule,
      new FastifyAdapter({ logger: true, http2: true }),
    );

image

What are your thoughts on this? I would like to get a speed increase due to http2

and by the way this is terrifying and amazing, but just look at the speed of this code in bun

image

image

and it's still 1 core and 1 thread!

Are you thinking of implementing nestia bun? It seems like it would be great. And for some reason typia doesn't work in bun

@SonderRill
Copy link
Author

by the way, taking the usual nest + fatify + typia, it turned out to be 17k requests per second. But if you leave TypedRoute.Post, the speed is cut in half. So it is best to leave the usual Post decorators from @nestjs/common

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant