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

Piston lag escalates massively with the total tile entity count.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 21w05a
    • 1.16.5
    • Community Consensus
    • (Unassigned)

      I recently started working on a lag efficient bulk storage system, currently it is performing quite well however one issue I have noticed is that even though the static lag of the system is very small. If I operate the instant dropper lines used to move items around the system, the milliseconds required per gametick increases drastically.

      I have heard a lot from the community of how whenever a piston pushes a block, it creates a new tile entity which is added to the list of all tile entities loaded in the world. And this operation gets increasingly expensive as the total number of tile entities increases, causing pistons to lag more from the mere presence of other tile entities such as hoppers, chests, barrels etc.

      I made a simple setup to demonstrate the severity of the issue:

      (/)Without tile entities present our static lag is only 0.740ms:

      (/)When we run the contraption with lots of pistons, observe that the MSPT rises to 8.152ms

      (+)Now we simply add 146 thousand barrels to our setup, this increases the size of the tile entity list.

      (/)Observe that our static lag is almost the same at 0.708ms:

      (x)Now activate our contraption with lots of pistons and observe that the MSPT has skyrocketed to almost 3x what we had previously at 22.523ms!

      This is because every time a piston moves, it adds a tile entity to our list which is full of barrels. Meaning the game is wasting reources parsing the larger list. This could easily be fixed by giving the moving_piston tile entity it's own list for the game to process, therefore the server only needs to parse the list of moving pistons instead of every single tile entity loaded in the world every time a piston moves.

            Unassigned Unassigned
            cubicmetre
            Votes:
            15 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: