Description
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.