-
-
Notifications
You must be signed in to change notification settings - Fork 799
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
Intern the String value #726
Comments
To add some context, here is a peek at the String key and value memory address, with existing implementation:
The keys are pointing to same string in the pool, while the value, even though they are the same, they are created on heap with each encountering of new record. |
I am open to this idea, but probably requires some sort of handler to let customization of which String values are to be |
Version
2.12.4
Feature request
Existing scenario
I think the
INTERN_FIELD_NAMES
flag is great thing to have, which is turned on by default. This would save greatly on the memory footprint especially when the message size is huge, imagine ~3.2 million position messages, all with same key like 'portfolio', 'book'.Instead of having ~3.2 million of
portfolio
in parsing each batch of message in heap, withINTERN_FIELD_NAMES
, it would result in only oneportfolio
on the string pool regardless of the message sizes, being ~3.2 million or even more.Changes proposed
A similar feature flag could be provided, even turned on by default as well, when parsing the values.
So that, back to the ~3.2 million records example, instead of having ~3.2 million portfolio names in the heap, the similar feature flag would result in only around ~200
portfolio name
(like Jason, Jackson) in the string pool.Possible changes
From here, it could take in the feature flag, and apply the intern if the flag is on
https://github.com/FasterXML/jackson-core/blob/2.14/src/main/java/com/fasterxml/jackson/core/util/TextBuffer.java#L797
The text was updated successfully, but these errors were encountered: