-
Notifications
You must be signed in to change notification settings - Fork 471
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
Use multiple locks in ByteBuddyMockFactory to reduce lock contention #1778
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1778 +/- ##
=============================================
+ Coverage 0 79.83% +79.83%
- Complexity 0 4077 +4077
=============================================
Files 0 425 +425
Lines 0 12916 +12916
Branches 0 1630 +1630
=============================================
+ Hits 0 10311 +10311
- Misses 0 1998 +1998
- Partials 0 607 +607
☔ View full report in Codecov by Sentry. |
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Outdated
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Outdated
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Outdated
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Show resolved
Hide resolved
...cs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockFactoryConcurrentSpec.groovy
Outdated
Show resolved
Hide resolved
...cs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockFactoryConcurrentSpec.groovy
Outdated
Show resolved
Hide resolved
...cs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockFactoryConcurrentSpec.groovy
Outdated
Show resolved
Hide resolved
...cs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockFactoryConcurrentSpec.groovy
Outdated
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Outdated
Show resolved
Hide resolved
Changed locking scheme in ByteBuddyMockFactory from a single global lock CACHE to cacheLocks with size 16. The used TypeCachingLock from cacheLocks depends on the hashcode of TypeCache.SimpleKey, which aggregates the types to mock. The old global CACHE lock did block Threads regardless, if they try to mock the same type or not. This is a similar fix as in Mockito: mockito/mockito#3095 Co-authored-by: Björn Kautler <Bjoern@Kautler.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx
…ctedConst * spockframework/master: Use multiple locks in ByteBuddyMockFactory to reduce lock contention (spockframework#1778) Fixup LICENSE file after change to geantyref (spockframework#1773) # Conflicts: # spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Changed locking scheme in ByteBuddyMockFactory from a single global lock CACHE to cacheLocks with size 16.
The used TypeCachingLock from cacheLocks depends on the hashcode of TypeCache.SimpleKey,
which aggregates the types to mock.
The old global CACHE lock did block Threads regardless, if they try to mock the same type or not.
This is a similar fix as in Mockito:
Mockito 3095