You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2014/03/18 17:06:43 UTC

[jira] [Resolved] (WICKET-5535) Intern strings generated by Wicket that have bigger chance to be duplicated

     [ https://issues.apache.org/jira/browse/WICKET-5535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-5535.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 7.0.0

Improving only in master branch because String#intern() is safer to be used with Java 7+

> Intern strings generated by Wicket that have bigger chance to be duplicated
> ---------------------------------------------------------------------------
>
>                 Key: WICKET-5535
>                 URL: https://issues.apache.org/jira/browse/WICKET-5535
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 7.0.0
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>             Fix For: 7.0.0
>
>
> I've been doing some performance measurements recently and I've noticed that Wicket produces some higher number of String objects like:
> - small numbers ("1", "2", "3", ...) generated from repeaters' String.valueOf(nextId)
> - HTML element names/attributes ("span", "div", ...) generated in XmlTag#getName, #getAttribute, ...
> We can reduce memory usage for those by using String#intern().
> Since Java 7 the interned strings are stored in the Heap memory so this won't affect negatively the perm generation.
> Interned strings are GC-ed so this is also not a concern.
> http://java-performance.info/string-intern-in-java-6-7-8/ provides good explanation how to avoid the CPU penalty caused by String#intern() if needed.



--
This message was sent by Atlassian JIRA
(v6.2#6252)