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

Improve Structure (subclass) construction performance. #1626

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

brettwooldridge
Copy link
Contributor

Fixes #1625 issue by caching the field list (fieldList) and validation state (validationMap) in addition to the existing layoutInfo and fieldOrder caches.

Caching this additional state provides substantial performance improvements.

@matthiasblaesing
Copy link
Member

matthiasblaesing commented Sep 22, 2024

@brettwooldridge thank you. Two requests:

  • Do you have performance numbers for this?
  • Please add an entry to CHANGES.md (refer to the existing entries for the target format).

Edit: Please also squash the changes when updating the changes file.

…idation state in addition to the existing layoutInfo and fieldOrder caches.
@brettwooldridge
Copy link
Contributor Author

@matthiasblaesing I have refactored the change using ReentrantReadWriteLock to substantially decrease contention as this is a 99.9% read/0.1% write type access pattern. Additionally, I updated the CHANGES.md as requested. All tests are passing.

Copy link
Contributor

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extra effort here! I agree Structures are one of the biggest opportunities for performance improvements; the improvements in releasing the backing Memory in a previous release were pretty significant (and I still think there's room to improve with a "cache" of the common 4- or 8- byte allocations) it's good to see unnecessary redundant calculations elimitated as well.

@matthiasblaesing
Copy link
Member

Thank you again and sorry for the delay in merging. Lets get this in.

@matthiasblaesing matthiasblaesing merged commit c9e3895 into java-native-access:master Oct 1, 2024
14 checks passed
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.

Structure Performance
3 participants