mojira.dev
MC-105461

Unnecessary large number of allocations of Enum arrays

While not technically a bug and not a huge performance issue, this could be trivially fixed.
The problem: Every call to Enum.values() creates a copy of the internal array of values since it could be modified by the caller. As a consequence, things as iterating over all values create large numbers of objects to be collected by the GC. This is especially noticeable for EnumFacing.values()

The fix: Simply store the value array in a static variable.

Comments 1

Is this still an issue in the most recent versions (currently that is 1.12.2, or the latest 1.13 development snapshot 18w07c) of Minecraft?

...

(Unassigned)

Unconfirmed

Minecraft 1.10.2

Retrieved