Skip to content

Replace value class related reflection calls with Methodhandle #355

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

Merged
merged 14 commits into from
Jun 14, 2025

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Jun 14, 2025

This change will improve throughput, at least with value class wraps Int, 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 or JsonKey.

Benchmarks

Using kogera-benchmark, a simple benchmark on value class wrapping Int 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.
chart

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.
chart (1)

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

@k163377 k163377 marked this pull request as ready for review June 14, 2025 12:09
@k163377 k163377 marked this pull request as draft June 14, 2025 12:12
@k163377 k163377 marked this pull request as ready for review June 14, 2025 12:37
@k163377 k163377 merged commit baadbd4 into develop Jun 14, 2025
2 checks passed
@k163377 k163377 deleted the methodhandle branch June 14, 2025 12:37
@github-actions github-actions bot mentioned this pull request Jun 14, 2025
6 tasks
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.

1 participant