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

Class.getSimpleName performance issue with large number of block entities

XMLWordPrintable

    • Confirmed

      The bug

      When there are large numbers of ticking block entities a lot of time is spent calling the class.getSimpleName() for the profiler, even though the profiler is not active.

      Steps to reproduce

      1. Create a new superflat world and /tp 0 ~ 0
      2. Create a lot of ticking block entities: /fill 0 ~ 0 100 ~2 100 minecraft:furnace

      Sampling results looks like this: getSimpleName.png

      Code analysis (using MCP names)

      In World.java there is a profiler section around each Block Entity's update call.

      this.theProfiler.startSection(tileentity.getClass().getSimpleName());
      ((ITickable)tileentity).update();
      this.theProfiler.endSection();
      

      Internally, profiler code is wrapped in if (this.profilingEnabled) statements, but this call to getSimpleName() is not, and it can have an impact.

            Unassigned Unassigned
            mezz mezz
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: