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 improvements for Kryo.isClosure() #956

Merged
merged 1 commit into from Apr 19, 2023

Conversation

theigl
Copy link
Collaborator

@theigl theigl commented Apr 19, 2023

This PR improves the default implementation of Kryo.isClosure() in two ways:

  1. Check if the type is synthetic
  2. Check if the simple name of the class contains a /

This is only slightly faster for hits, but significantly faster for misses:

Benchmark Mode Cnt Score Units
ClosureBenchmark.newHit thrpt 2 231402690,531 ops/s
ClosureBenchmark.oldHit thrpt 2 188889209,053 ops/s
ClosureBenchmark.newMiss thrpt 2 1796295832,164 ops/s
ClosureBenchmark.oldMiss thrpt 2 174581347,713 ops/s

I hope that Class.isSynthetic() is true for closures on all JDKs.

@theigl theigl self-assigned this Apr 19, 2023
@theigl theigl merged commit 8742e6e into master Apr 19, 2023
1 check passed
@theigl theigl deleted the faster-is-closure-check branch April 19, 2023 12:44
@theigl theigl mentioned this pull request Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant