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

Performance improvement of strictNullChecks #881

Draft
wants to merge 6 commits into
base: 2.19
Choose a base branch
from

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Jan 13, 2025

Currently, if the strictNullChecks option is enabled, the deserialization performance of collections is significantly degraded.
It also reduces the performance of all deserialization, although very slightly.

The cause of the significant performance degradation is the dynamic definition checks on Kotlin at each deserialization.
Therefore, by moving the processing backend to JsonSetter and limiting the definition checks to initialization time, I have greatly improved performance.

This change closes #719.


The results of the improvements are summarized below.

Benchmark Deterioration rate(before) Deterioration rate(after) Improvement rate
E_5P.empty 0.721498147 0.9893744169 1.396036277
E_5P.fiveContents 0.7992864106 1.019547368 1.266283685
T_20P.empty 0.6930720275 0.9940202384 1.445030387
T_20P.fiveContents 0.775168912 0.9815612061 1.261301297

Deterioration rate shows the rate of degradation of throughput if the check was enabled.
The closer this is to 1, the smaller the degradation.

Improvement rate shows how much the throughput improved before and after the change when the check was enabled.
The larger this value is, the greater the improvement.

With the new implementation, there is virtually no degradation in throughput even when checks are enabled.
Also, throughput is at least 1.25 times better than before the change.

For a complete benchmark and explanation of the results, please see below.
https://github.com/k163377/strict-null-checks-benchmark

@k163377 k163377 marked this pull request as draft January 13, 2025 11:36
@k163377
Copy link
Contributor Author

k163377 commented Jan 13, 2025

If the exceptions raised were to be changed destructively, they needed to be deprecated correctly.
It needs to be fundamentally reworked and therefore drafted.

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

Successfully merging this pull request may close these issues.

Performance improvement of strictNullCheck
1 participant