-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Optimize Quantity.parse to avoid regex overhead #4992
Conversation
default: | ||
//noinspection UnnecessaryContinue - satisfy Sonar | ||
continue; |
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.
Without this default
case, Sonar flags this as a critical Add a default case to this switch.
, though with the default
case of continue
IntelliJ then flags it as unnecessary. Defer to your preferences if you'd like an empty default
case or if the comment suppressing IntelliJ warning is ok with you all.
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.
Sonar false positives can be disabled by using a @SuppressWarnings
annotation followed by the rule id e.g. @SuppressWarnings("java:S107")
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
It looks like the Let me know if there's anything else you need to merge. Thanks! |
It's definitely not related, but it's not a known test flake. Captured as #5002 - there does appear to be a timing issue with the jetty logic. |
Kudos, SonarCloud Quality Gate passed! |
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!
Description
Optimize
Quantity.parse
to avoid regex overhead. While reviewing some JFR profiles from a service using fabric8.io k8s client, I noticed some significant allocations and CPU time spent parsing quantities using regex from interacting with k8s APIs. We can avoid some of these overheads by simplifying the parsing to identify when and where to split quantity and units.Type of change
test, version modification, documentation, etc.)
Checklist