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

[#196/#197] implement caching for unproxy results #198

Merged

Conversation

marcus-talbot42
Copy link
Contributor

  • Created UnproxyResultStore, allowing for caching of unproxied classes.
  • Fixed the premature evaluation of String#formatted(Object ...), by only passing String literals to the performance logger.

Closes #196 #197

- Used to store the result BeanUnproxy#unproxy(Class)-calls.
- Available as a singleton, as the results of BeanUnproxy#unproxy(Class) are deterministic, allowing the cache to be global.
- Updated logging, to prevent premature evaluation of String-formatting during performance logging.
- Updated usages of BeanUnproxy#unproxy(Class), to use UnproxyResultStore#getOrComputeUnproxyResult, which makes use of the global unproxy cache.
@marcus-talbot42 marcus-talbot42 self-assigned this Apr 3, 2024
@marcus-talbot42 marcus-talbot42 changed the title Improvement/197 implement caching for unproxy results [#196/#197] implement caching for unproxy results Apr 3, 2024
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.80%. Comparing base (e82cc98) to head (e484de8).

❗ Current head e484de8 differs from pull request most recent head 6f52407. Consider uploading reports for the commit 6f52407 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #198      +/-   ##
============================================
+ Coverage     87.76%   87.80%   +0.03%     
- Complexity      995      998       +3     
============================================
  Files           109      110       +1     
  Lines          2199     2206       +7     
  Branches        248      247       -1     
============================================
+ Hits           1930     1937       +7     
  Misses          176      176              
  Partials         93       93              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- Made UnproxyResultStore#getInstance synchronized, for readability.
- UnproxyResultStore#unproxyResultClassStore is now a ConcurrentHashMap.
- Instance is no longer volatile.
- Added BeanMapperPerformanceLogger#runTimed(Supplier, String, Object...), to allow for just-in-time formatting of log messages.
@marcus-talbot42 marcus-talbot42 merged commit 725c26a into master Apr 3, 2024
1 of 2 checks passed
@marcus-talbot42 marcus-talbot42 deleted the improvement/197-Implement-caching-for-Unproxy-results branch April 3, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calls to the logger should not contain a call to String.formatted(Object...)
2 participants