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

feat(json-mapper): create JsonMapperCompiler #2404

Merged
merged 7 commits into from
Sep 17, 2023

Conversation

Romakita
Copy link
Collaborator

@Romakita Romakita commented Aug 4, 2023

Information

Type Breaking change
Feature No

Information

Create a new JsonMapper that compiile mappers for each model before using it. It should optimize the JsonMapper library

Todos

  • Tests
  • Coverage
  • Example
  • Documentation

@github-actions
Copy link

github-actions bot commented Aug 4, 2023

Benchmarks

  • Machine: linux x64 | 2 vCPUs | 6.8GB Mem
  • Node: v16.20.1
  • Run: Fri Aug 04 2023 07:03:15 GMT+0000 (Coordinated Universal Time)
  • Method: autocannon -c 100 -d 10 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)
Version Router Requests/s Latency Throughput/Mb
fastify 3.29.4 63299.2 15.26 11.29
nest-fastify 8.4.3 54418.9 17.87 9.71
koa 2.13.4 45046.4 21.70 8.03
express 4.18.1 11763.3 84.28 2.10
fastify-big-json 3.29.4 10900.0 90.90 125.40
nest 8.4.3 10654.2 93.06 2.56
express-morgan 4.18.1 7188.4 137.95 1.28
express-injector 4.18.1 N/A N/A N/A
fastify-injector 3.29.4 N/A N/A N/A
tsed-express 7.34.2 N/A N/A N/A
tsed-koa 7.34.2 N/A N/A N/A

Explanation

The benchmark shows a performance difference between the frameworks. We note that Ts.ED is often last. In fact, Ts.ED uses features useful to a production application which reduce its performance.

For example, Ts.ED initializes a sandbox (async_hook) for each request in order to work in an isolated context if necessary.
It also initializes the elements necessary for monitoring requests in a log manager.

All this at a necessary cost that reflects the reality of a production application ;)

@github-actions
Copy link

Benchmarks

  • Machine: linux x64 | 2 vCPUs | 6.8GB Mem
  • Node: v16.20.1
  • Run: Thu Aug 10 2023 15:29:44 GMT+0000 (Coordinated Universal Time)
  • Method: autocannon -c 100 -d 10 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)
Version Router Requests/s Latency Throughput/Mb
fastify 3.29.4 43814.4 22.39 7.81
nest-fastify 8.4.3 43239.3 22.63 7.71
koa 2.13.4 34646.6 28.36 6.18
express 4.18.1 8738.7 113.50 1.56
nest 8.4.3 7436.2 133.40 1.79
fastify-big-json 3.29.4 7306.4 135.70 84.05
express-morgan 4.18.1 4899.3 203.01 0.87
express-injector 4.18.1 N/A N/A N/A
fastify-injector 3.29.4 N/A N/A N/A
tsed-express 7.34.2 N/A N/A N/A
tsed-koa 7.34.2 N/A N/A N/A

Explanation

The benchmark shows a performance difference between the frameworks. We note that Ts.ED is often last. In fact, Ts.ED uses features useful to a production application which reduce its performance.

For example, Ts.ED initializes a sandbox (async_hook) for each request in order to work in an isolated context if necessary.
It also initializes the elements necessary for monitoring requests in a log manager.

All this at a necessary cost that reflects the reality of a production application ;)

@Romakita Romakita force-pushed the production branch 9 times, most recently from df09689 to eed91ec Compare September 4, 2023 07:42
@Romakita Romakita merged commit d7d5c22 into production Sep 17, 2023
34 of 35 checks passed
@Romakita Romakita deleted the feat-json-mapper-compilation branch September 17, 2023 07:42
@Romakita
Copy link
Collaborator Author

🎉 This PR is included in version 7.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant