Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-105461

Unnecessary large number of allocations of Enum arrays

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • Minecraft 1.10.2
    • None
    • Unconfirmed

      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.

            Unassigned Unassigned
            mathe172 ...
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: