-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
review: perf: Avoid slow CCE. Check acceptable type when possible #1541
Conversation
THANK YOU! |
} | ||
private static final Pattern cceMessagePattern = Pattern.compile("(\\S+) cannot be cast to (\\S+)"); | ||
private static boolean canExtractTypeFromCCE = true; |
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.
Is it normal that canExtractTypeFromCCE cannot be set to true?
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.
the canExtractTypeFromCCE is here as fallback for the case, when somebody is using different java implementation whose CCE error message looks different. Only in such case the value is set to false and the detection of acceptable type from message is OFF.
Is it normal that canExtractTypeFromCCE cannot be set to true?
So I see actually no case when such setter would be needed.
8c74041
to
668e66e
Compare
The ignoring of CCE caused by CtQuery filters was buggy, because for example CtConsumer implemented This PR solves this problem by these changes:
This PR fixes two other bugs, which are now visible
This PR is finished and ready for merge from my point of view. |
It seems ok to me. @tdurieux ? |
To be honest, I don't understand completely the impact of this change on CtQuery. |
Thanks @pvojtechovsky |
I wanted to debug
MainTest#testMain
and I have found that it is terribly slow (needs nearly 19 min) in debug mode. 18 min is spent in creation of ClassCastException stacktraces.This PR detects acceptable type from message of first CCE and then checks whether class of input is acceptable - so it avoids throwing of CCE - performs faster in debug (52s)
The performance improvement is only little in non debug mode (28s origin, 25s after improvement).
Actually this PR fails on java 7/8 source compliance (will be fixed by #1539)