[
https://issues.apache.org/jira/browse/OAK-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13679454#comment-13679454
]
Thomas Mueller edited comment on OAK-861 at 6/10/13 12:08 PM:
--------------------------------------------------------------
Actually, it's not so easy to just move the class, as it has many dependencies:
the CONSTANTS map caches the most common JCR constants, which I guess should
somewhat improve performance / reduce memory usage.
I still like to avoid having two copies of (basically) the same code.
One solution is to split the class: StringCache (which is in oak-commons, but
doesn't include the CONSTANTS map), and OakStringCache (which stays in
oak-core, includes the CONSTANTS map, and internally calls StringCache).
oak-core would use OakStringCache, and the MongoMK could use StringCache.
Another solution is: don't use the CONSTANTS map, but instead increase the
cache size. The idea behind this is that the common entries in the CONSTANTS
map will anyway end up staying in the STRING_CACHE array.
-----
The StringCache.get method always copies the String if it is not in the cache
(using "new String( x )"). This is not always required, for example if the
String was created from a StringBuilder. For such cases, it would be good to
have a second method that avoid creating a new object, for example
StringCache.getWithoutCopying or so. But first I will check if it's really
needed.
was (Author: tmueller):
Actually, it's not so easy to just move the class, as it has many
dependencies: the CONSTANTS map caches the most common JCR constants, which I
guess should somewhat improve performance / reduce memory usage.
I still like to avoid having two copies of (basically) the same code.
One solution is to split the class: StringCache (which is in oak-commons, but
doesn't include the CONSTANTS map), and OakStringCache (which stays in
oak-core, includes the CONSTANTS map, and internally calls StringCache).
oak-core would use OakStringCache, and the MongoMK could use StringCache.
Another solution is: don't use the CONSTANTS map, but instead increase the
cache size. The idea behind this is that the common entries in the CONSTANTS
map will anyway end up staying in the STRING_CACHE array.
-----
The StringCache.get method always copies the String if it is not in the cache
(using "new String(x)"). This is not always required, for example if the String
was created from a StringBuilder. For such cases, it would be good to have a
second method that avoid creating a new object, for example
StringCache.getWithoutCopying or so. But first I will check if it's really
needed.
> Move StringCache to oak-commons
> -------------------------------
>
> Key: OAK-861
> URL: https://issues.apache.org/jira/browse/OAK-861
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: commons, core, mongomk
> Reporter: Thomas Mueller
> Priority: Minor
>
> The StringCache is currently im oak-core, but the MongoMK (for example) would
> also benefit from using it. Therefore, I would like to move the StringCache
> class to oak-commons.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira