Performance improvement of strictNullChecks
#881
Draft
+192
−54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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