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

SkipClassLoaderMatcher use str-switch in shouldSkipClass(ClassLoader) #1235

Merged

Conversation

lpriima
Copy link
Contributor

@lpriima lpriima commented Feb 20, 2020

string-switch statement seems to be 0.5 seconds faster than HashSet::contains on petclinic app

@lpriima lpriima requested a review from a team as a code owner February 20, 2020 06:54
@lpriima lpriima force-pushed the lpriima/SkipClassLoaderMatcher#shouldSkipClass_by_switch branch 2 times, most recently from 6a88b1a to bcb42cc Compare February 20, 2020 20:33
@lpriima
Copy link
Contributor Author

lpriima commented Feb 20, 2020

In test I want to check java-language-specific hardcoded invariant: DatadogClassLoader.class.getName().equals("datadog.trace.bootstrap.DatadogClassLoader") but codenarcTest groovy style check doesn't allow me to use pure java code and forces me to write DatadogClassLoader.getName().equals("datadog.trace.bootstrap.DatadogClassLoader") .

@tylerbenson tylerbenson added the tag: performance Performance related changes label Feb 21, 2020
@dougqh
Copy link
Contributor

dougqh commented Feb 21, 2020

In test I want to check java-language-specific hardcoded invariant: DatadogClassLoader.class.getName().equals("datadog.trace.bootstrap.DatadogClassLoader") but codenarcTest groovy style check doesn't allow me to use pure java code and forces me to write DatadogClassLoader.getName().equals("datadog.trace.bootstrap.DatadogClassLoader") .

Yes, they are equivalent, but I do rather wish I could write the Java-style myself.
You can make it even more "groovy".
DatadogClassLoader.name == ""datadog.trace.bootstrap.DatadogClassLoader"

I'm not sure if codeNarc checks Groovy getters and equivalence.

@lpriima lpriima force-pushed the lpriima/SkipClassLoaderMatcher#shouldSkipClass_by_switch branch from bcb42cc to 3bde6f9 Compare February 21, 2020 03:46
@lpriima lpriima force-pushed the lpriima/SkipClassLoaderMatcher#shouldSkipClass_by_switch branch from 3bde6f9 to 52e0eb9 Compare February 21, 2020 05:02
@lpriima lpriima merged commit 51ca429 into master Feb 21, 2020
@lpriima lpriima deleted the lpriima/SkipClassLoaderMatcher#shouldSkipClass_by_switch branch February 21, 2020 05:20
@randomanderson randomanderson added this to the 0.44.0 milestone Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: performance Performance related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants