-
Notifications
You must be signed in to change notification settings - Fork 64
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
Cache LifecycleMethods results: findBeforeTryMethods, findAfterTryMethods, etc #429
Comments
Sample fix: + private static final ClassValue<List<Method>> findBeforeTryMethods = new ClassValue<List<Method>>() {
+ @Override
+ protected List<Method> computeValue(Class<?> testClass) {
+ return findMethods(testClass, false, true, BeforeTry.class, HierarchyTraversalMode.TOP_DOWN);
+ }
+ };
+
static List<Method> findBeforeTryMethods(Class<?> testClass) {
- return findMethods(testClass, false, true, BeforeTry.class, HierarchyTraversalMode.TOP_DOWN);
+ return findBeforeTryMethods.get(testClass);
}
+ private static final ClassValue<List<Method>> findAfterTryMethods = new ClassValue<List<Method>>() {
+ @Override
+ protected List<Method> computeValue(Class<?> testClass) {
+ return findMethods(testClass, false, true, AfterTry.class, HierarchyTraversalMode.BOTTOM_UP);
+ }
+ };
+
static List<Method> findAfterTryMethods(Class<?> testClass) {
- return findMethods(testClass, false, true, AfterTry.class, HierarchyTraversalMode.BOTTOM_UP);
+ return findAfterTryMethods.get(testClass);
} WDYT? It improves shrink time from ~60s to 30sec for case like #428 (comment) (increasing |
vlsi
pushed a commit
to vlsi/jqwik
that referenced
this issue
Dec 14, 2022
…perty, and container methods Fixes jqwik-team#429
vlsi
pushed a commit
to vlsi/jqwik
that referenced
this issue
Dec 14, 2022
…perty, and container methods Fixes jqwik-team#429
jlink
pushed a commit
that referenced
this issue
Dec 17, 2022
…perty, and container methods Fixes #429
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testing Problem
LifecycleMethods
consumes significant CPU time performing the same reflective lookup.Suggested Solution
Cache the results via https://docs.oracle.com/javase/7/docs/api/java/lang/ClassValue.html or something like that.
Profiling results
Allocation:
CPU:
The text was updated successfully, but these errors were encountered: