-
Notifications
You must be signed in to change notification settings - Fork 70
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
replace guava functionality with equivalent JDK or custom features #319
replace guava functionality with equivalent JDK or custom features #319
Conversation
…ich allows a large (2.7MB) dependency to be dropped from size-sensitive deployments
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 since the CI passes, but haven't read the code changes in details. Looking at the project history the guava dep was added very early to take advantage of a few specific types (6c89538), should be no harm replacing them with custom implementations.
Would definitely like @truthbk's review on this though, so leaving approval up to him.
The failing test ( |
There are some follow up PRs which make sense if they're all merged in the order of creation. If any of them are problematic the commits can be dropped and the PRs can be merged in isolation. |
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; |
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.
minor: afaik the styleguide says don't use wildcard imports?
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.
doesn't apply to test
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.
Actually this is up to @truthbk - wildcard imports (and some unused imports) are common in the test folder.
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.
Feel free to ignore but @mcculls is right, I know we already have a bunch of wildcard imports in the test package, but let's try to avoid adding more, if possible.
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.
ok will address this
@@ -0,0 +1,47 @@ | |||
package org.datadog.jmxfetch.util; | |||
|
|||
public final class ByteArraySearcher { |
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.
interesting matching technique - I think it would be worth adding a small description of the algorithm used here
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.
This is the literal version of the bitap algorithm which is the only one I know which takes less space to write than the naive quadratic algorithm used in Guava.
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.
Just the wildcard to fix if you have the time, otherwise this looks great, and is very welcome!
Thank you! 🙇
} | ||
} | ||
if (count.get() <= max) { | ||
// may log a little too often if there are races |
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.
I think this is fine, not a huge concern.
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; |
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.
Feel free to ignore but @mcculls is right, I know we already have a bunch of wildcard imports in the test package, but let's try to avoid adding more, if possible.
The motivation here is to reduce the deployment size by shedding a 2.7MB dependency which isn't extensively used.