Uh oh!
There was an error while loading. Please reload this page.
Avoid String concatenation for lookup in StaticMessageSource - #22451
Avoid String concatenation for lookup in StaticMessageSource#22451stsypanov wants to merge 1 commit into
Conversation
68eb1d6 to
3a3058bComparestsypanov
commented
Aug 21, 2019
@jhoeller I've slightly simplified the patch to use Array.asList |
3a3058b to
e4241fdComparestsypanov
commented
Nov 13, 2019
@jhoeller hello, any updates on this? |
jhoeller
commented
Nov 13, 2019
On review, I'll rather go with a nested As a side note, part of the original design of I'll repurpose this issue accordingly. Thanks for the PR, in any case! |
Currently StaticMessageSource employs String composed of key and stringified Locale as key in map:
As a result at each call to
Map::get/Map::putwe have to concat Strings resulting in allocations ofStringBuilderand copyingchar[]. Instead I propose to use separately defined immutable Key.I've tested behaviour with benchmark
Patched consumes much less memory on key allocation and does it faster, performance of equals/hashCode is mostly the same (tested at work on i7-7700):