Skip to content

Conversation

@brenuart
Copy link
Collaborator

@brenuart brenuart commented Sep 8, 2021

Most Logstash marker don't have any children/reference at all. Creating the referenceList upfront is a waste of memory and additional pressure on the GC. This PR modifies the implementation to create the reference list eagerly when the first reference is added. See #617 (comment) for the motivations behind this change.

Most Logstash marker don't have any children/reference at all. Creating the referenceList upfront is a waste of memory and additional pressure on the GC.

This commit modifies the implementation to create the reference list when the first reference is added.
This class is now our own implementation - remove copy of SLF4J copyright notice
@brenuart brenuart linked an issue Sep 8, 2021 that may be closed by this pull request
@brenuart
Copy link
Collaborator Author

brenuart commented Sep 8, 2021

@philsttr EmptyLogstashMarker does not override equals/hascode. Equality is therefore solely on the marker name. Most (if not all) other logstash markers also require that "other" is of the exact same class. Shouldn't it be the case here as well ?

@brenuart brenuart marked this pull request as ready for review September 8, 2021 09:51
@brenuart brenuart requested a review from philsttr September 8, 2021 09:51
Copy link
Collaborator

@philsttr philsttr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philsttr EmptyLogstashMarker does not override equals/hascode. Equality is therefore solely on the marker name. Most (if not all) other logstash markers also require that "other" is of the exact same class. Shouldn't it be the case here as well ?

Yes, please add a check for the same class.

contains() should accept null values and return false in this case. Calling code will not have to test for nullability before using the method and still have a consistent result
Revert changes made to equals() in f29bb2c
@brenuart brenuart merged commit d57511c into main Sep 10, 2021
@brenuart brenuart deleted the marker-refactoring branch September 10, 2021 09:13
@philsttr philsttr added this to the 7.0 milestone Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce visibility of LogstashBasicMarker LogstashBasicMarker implementation is inefficient and out-off-sync with implementation provided by Slf4J

3 participants