Skip to content
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

Improvement: Add option to cache byte[] to String mappings for Key #497

Open
Matulis opened this issue Apr 18, 2019 · 3 comments
Open

Improvement: Add option to cache byte[] to String mappings for Key #497

Matulis opened this issue Apr 18, 2019 · 3 comments

Comments

@Matulis
Copy link

Matulis commented Apr 18, 2019

In some cases when you know you have a limited set of keys and have a very large volume of incoming messages sharing the same keys, it may be beneficial to store a mapping of byte[] to Strings, this can reduce the object creation from decoding as well as allow you to utilize the same string objects in memory.

For example Jackson allows the JsonFactory feature flag of: https://fasterxml.github.io/jackson-core/javadoc/2.8/com/fasterxml/jackson/core/JsonFactory.Feature.html#INTERN_FIELD_NAMES

@Matulis
Copy link
Author

Matulis commented Apr 18, 2019

Implementation could be pretty simple, but would be nice to add a dependency on a cache library(Guava Cache or Caffeine) to avoid having to roll a new one, thoughts?

@Matulis
Copy link
Author

Matulis commented Apr 18, 2019

Actually I just realized that the actual implementation of the cache can be left up to the user, so I will submit a pull request with the interface that can optionally be implemented by end users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants