-
Notifications
You must be signed in to change notification settings - Fork 246
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
Ingest field configuration helper cache #2614
base: integration
Are you sure you want to change the base?
Conversation
c35be9b
to
afdf5af
Compare
db63c0c
to
3f7d5b6
Compare
|
||
private static class ResultEntry { | ||
private final String fieldName; | ||
private final EnumMap<AttributeType,Boolean> resultMap; |
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.
Do we not need to limit the size of this cache?
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 the map here will be limited to the size of the AttributeType (which was in the current class - maybe we should change the name). I tried an alternate version which used a switch statement on the enum and individual boolean variables, but it did not seem to impact the timing w/JMH. I will confirm the timing again - and we can also update to have a switch statement and explicit boolean results.
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.
An approach with a switch statement and primitive boolean variables was slightly quicker on second pass. I updated the logic, please let me know if we should evaluate the previous approach.
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.
Discussed additional performance ideas, going to run additional tests.
public void testCachingBehaviorWillCallBaseMethods() { | ||
// @formatter:off | ||
Stream.of(new Object[][] { | ||
new Object[] { |
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.
Are we actually calling all these pairs?
You are iterating over an array of arrays but there's only 1 inner array with 12 elements in it.
It seems like we want 6 inner arrays, each with two elements {action, verify}
I think we're actually only testing the isIndexOnlyField pair 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.
It also has me wondering if maybe it's just easier to do the manual calls in the test instead of dealing with all the method references and such.
cachedHelper.isIndexOnlyField(fieldName);
verify(mockHelper).isIndexOnlyField(fieldName);
cachedHelper.isIndexedField(fieldName);
verify(mockHelper).isIndexedField(fieldName);
// ...
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.
That is a bug, thank you for catching that. In regards to the manual tests - I updated, thank you.
3f7d5b6
to
47d1cf3
Compare
Implementation of a field helper cache using an LRU map.
BaseIngestHelper
instance and will wrap an existingFieldConfigHelper
implementation.Closes #2612