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

Exponential lag because of entities in 1.9

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Won't Fix
    • Affects Version/s: Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 16w15a, Minecraft 16w15b, Minecraft 1.9.3, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 1.10.2
    • Fix Version/s: Minecraft 16w15b
    • Labels:
      None
    • Environment:

      Windows 10 - Java version included in Minecraft

    • Confirmation Status:
      Community Consensus

      Description

      Here is a comparison bewteen lag caused by huge amounts of entities in 1.8.9 & in 1.9.

      To compare the two version I use the following setup with 3 command blocks :

      First Command Block
      /kill @e[type=ArmorStand]
      
      Second Command Block
      /summon ArmorStand ~ ~1 ~ {Invulnerable:1b,Marker:1b,NoGravity:1b,Invisible:1b,Team:"TEST"}
      
      Third Command Block
      /execute @e[type=ArmorStand] ~ ~ ~ summon ArmorStand ~ ~ ~ {Invulnerable:1b,Marker:1b,NoGravity:1b,Invisible:1b,Team:"TEST"}
      

      See the Setup picture below.

      So for each version, I first activate the second Command Block (so 1 ArmorStand spawn). After what I activate the third Command Block many times, so the number of ArmorStand increase like 2^n.

      When I arrive at 512 ArmorStands, I take a screenshot with the debug pie on (Alt+F3). Same for 1024, 2048 & 4096 ArmorStands.
      Before making the 1.9 test, I activate the first command block to kill every ArmorStand. After opening the world in 1.9 I do the following command : /scoreboard teams option TEST collisionRule never. It's very important.

      PS : I define "lag" with the color & the height of the debug pie.

      Here are the results :

      1.8.9 :

      • 512 : 89 FPS ; No lag.
      • 1024 : 84 FPS ; A few lag.
      • 2048 : 40 FPS ; Definitely becoming laggy.
      • 4096 : 15 FPS ; Very laggy.

      1.9 :

      • 512 : 82 FPS ; Very few lag.
      • 1024 : 2 FPS ; Unplayable, I can't even see the top of the debug pie.
      • 2048 or higher : Minecraft crash, so I can't even take a screenshot.

      See the screenshots for each step

      Conclusion : The lag caused by entities in 1.9 seems to grow exponentially, because for 512 AS there is no real difference, but for 1024 AS there's no problem in 1.8.9 when in 1.9 it's unplayable.

      I think this is due to the new collision of entities. But this doesn't make sense because the ArmorStand are in Marker mode & are in a team without collision.

      I think the way it's calculated doesn't care if the entity should take collision or not - it calculates the collision anyway, and then don't apply it if the entity do not take collisions.

      EDIT : World download are now in Attachments files.


      Code analysis by [Mod] Marcono1234 can be found in this comment.


      Possible fix made by Nasm Nasmus can be found in this comment

        Attachments

        1. 1.8 1024 AS.png
          1.8 1024 AS.png
          210 kB
        2. 1.8 2048 AS.png
          1.8 2048 AS.png
          212 kB
        3. 1.8 4096 AS.png
          1.8 4096 AS.png
          240 kB
        4. 1.8 512 AS.png
          1.8 512 AS.png
          202 kB
        5. 1.9 1024 AS.png
          1.9 1024 AS.png
          199 kB
        6. 1.9 512 AS.png
          1.9 512 AS.png
          217 kB
        7. 2016-05-21_11.32.00.png
          2016-05-21_11.32.00.png
          114 kB
        8. Lagtest 1.8.9.zip
          531 kB
        9. Lagtest 1.9.zip
          538 kB
        10. Setup.png
          Setup.png
          98 kB

          Issue Links

            Activity

              People

              • Assignee:
                grum [Mojang] Grum (Erik Broes)
                Reporter:
                TheMrZZ TheMrZZ
              • Votes:
                47 Vote for this issue
                Watchers:
                28 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: