I have a monstrously big enumerator, almost 1400 entries, that I use to represent font icons from FontAwesome.
Each enum constant has two values:
- the icon's description, e.g. "fas-user"
- the Unicode character, e.g. '\uEE0D'
I'm facing performance issues with this solution because when the class is first loaded by the JVM it takes I think around 50ms.
I realized this issue in a GUI app. When showing a popup that uses icons from that enum there's a short but visible delay which is not ideal.
Question is, do you have any solution/replacement?
I tried transforming the enum to a standard class and putting every icon in a static HashMap. Early testing does not show the same overhead as the enum, but I'm not 100% sure.