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

fix(json-mapper): fix serialization and deserialization of optional collections produce [null] when null is passed #2466

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

Romakita
Copy link
Collaborator

@Romakita Romakita commented Oct 5, 2023

Closes: #2465

Information

Type Breaking change
Fix No

Todos

  • Tests
  • Coverage
  • Example
  • Documentation

…ollections produce [null] when null is passed

Closes: #2465
(message) =>
message.includes("[skip ci]") ||
!!message.match(
/^((feat|fix|hotfix|tech|bugfix)\/(([0-9]+)\.?)+(\.[a-zA-Z]+)+) \(#+([0-9]+)\)/g // merge commits (matching a branch name, eg. 'feat/999.bla.bla (#123)')

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'fix/' and containing many repetitions of '0'.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Configuration file for commitlint

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

Benchmarks

  • Machine: linux x64 | 2 vCPUs | 6.8GB Mem
  • Node: v16.20.2
  • Run: Thu Oct 05 2023 06:44:36 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 51584.0 18.92 9.20
nest-fastify 8.4.3 46211.2 21.18 8.24
koa 2.13.4 39535.2 24.83 7.05
fastify-injector 3.29.4 25912.0 38.06 5.91
express 4.18.1 10068.6 98.64 1.80
tsed-koa 7.36.5 9264.5 106.99 8.09
nest 8.4.3 8761.0 113.23 2.11
fastify-big-json 3.29.4 8690.6 114.15 99.97
express-injector 4.18.1 7984.2 124.22 1.82
tsed-express 7.36.5 7279.8 136.12 1.33
express-morgan 4.18.1 5892.2 168.23 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 ;)

@Romakita Romakita merged commit 147ae63 into production Oct 5, 2023
36 checks passed
@Romakita Romakita deleted the fix-2465-array-null-deserialization branch October 5, 2023 06:49
@Romakita
Copy link
Collaborator Author

Romakita commented Oct 5, 2023

🎉 This PR is included in version 7.36.6 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Serialization and deserialization of optional collections produce [null] when null passed
1 participant