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(platform-params): make RawPathParams configurable like is it for PathParams (useValidation, useType, etc...) #2517

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

Romakita
Copy link
Collaborator

@Romakita Romakita commented Nov 8, 2023

Closes: #2515

@Romakita Romakita linked an issue Nov 8, 2023 that may be closed by this pull request
Copy link

github-actions bot commented Nov 8, 2023

Benchmarks

  • Machine: linux x64 | 2 vCPUs | 6.8GB Mem
  • Node: v16.20.2
  • Run: Wed Nov 08 2023 07:14:21 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 53468.8 18.25 9.53
nest-fastify 8.4.3 47840.0 20.42 8.53
koa 2.13.4 40160.0 24.41 7.16
fastify-injector 3.29.4 27019.2 36.63 6.16
express 4.18.1 10316.2 96.18 1.84
tsed-koa 7.43.1 9360.2 105.84 8.18
nest 8.4.3 8932.2 110.99 2.15
fastify-big-json 3.29.4 8910.2 111.33 102.51
express-injector 4.18.1 8133.8 121.90 1.85
tsed-express 7.43.1 7325.6 135.27 1.34
express-morgan 4.18.1 5898.0 167.98 1.05

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 ;)

… PathParams (useValidation, useType, etc...)

Closes: #2515
@Romakita Romakita force-pushed the 2515-feat-validate-raw-path-params branch from 8713696 to 8bf8d76 Compare November 8, 2023 14:20
Copy link

github-actions bot commented Nov 8, 2023

Benchmarks

  • Machine: linux x64 | 4 vCPUs | 15.6GB Mem
  • Node: v16.20.2
  • Run: Wed Nov 08 2023 14:30:14 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 55097.6 17.66 9.83
nest-fastify 8.4.3 48502.4 20.12 8.65
koa 2.13.4 40345.6 24.28 7.19
fastify-injector 3.29.4 28134.4 35.01 6.41
express 4.18.1 12020.0 82.49 2.14
tsed-koa 7.43.2 11884.0 83.33 10.38
fastify-big-json 3.29.4 11318.2 87.61 130.21
nest 8.4.3 10516.0 94.19 2.53
express-injector 4.18.1 10025.1 98.88 2.29
tsed-express 7.43.2 9635.8 102.88 1.76
express-morgan 4.18.1 7178.7 138.25 1.28

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 ;)

expression
expression,
useValidation,
useMapper,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure about useMapper and useType here, because if a user would use them, then it would make no sense to use RawPathParams over PathParams, would it? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... I realize, is just an equivalent of PathParams with the correct option XD

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will say that this will allow the dev to customize the behavior of the decorator starting from the case where everything is false (and vice versa).

@Romakita Romakita merged commit eeddb61 into production Nov 8, 2023
36 checks passed
@Romakita Romakita deleted the 2515-feat-validate-raw-path-params branch November 8, 2023 15:44
@Romakita
Copy link
Collaborator Author

Romakita commented Nov 8, 2023

🎉 This PR is included in version 7.44.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.

feat: validate raw path params
2 participants