Replace value class
related reflection calls with Methodhandle
#355
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.
This change will improve throughput, at least with
value class
wrapsInt
,Long
,String
, or (Java
)UUID
.However, first-time performance will be degraded.
Also, performance may not be improved for
value class
that wraps other classes.Although not shown in the benchmark, greater improvement is expected, especially with respect to serialization using
JsonValue
orJsonKey
.Benchmarks
Using kogera-benchmark, a simple benchmark on
value class
wrappingInt
was performed.The raw data is uploaded below.
https://docs.google.com/spreadsheets/d/1R8JpbOifsW5LQAl--GOkVmvQcwezuhg-jjIQpj8ZUQI/edit?gid=0#gid=0
Throughput(Higher is better)
The results show that both serialization and deserialization have improved.

The trend in scores for deserialization is a bit strange, since the improvement should basically be proportional to the number of properties, but it seems to generally improve throughput by 7% or more.
The trend of the scores for serialization is as expected, improving throughput by at least 10%.
Single shot(Lower is better)
From the results, it can be read that the first-time execution performance is degraded.

Among those verified, the amount of this degradation was about 9% at worst and less than 5% in most cases.