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

Rail updates are 4-5x times laggier since 1.14 if the rail is on top of a non-full cube

XMLWordPrintable

    • Confirmed
    • Performance

      Powering and depowering rails that are on top of non-full cubes is 4 to 5 times laggier since 1.14 than 1.12.2 and below

      "The primary bottleneck lies in shape comparison which is performed to determine whether the block beneath the rail is solid on top and can support it." - JellySquid

      • 1.12.2 used a simple boolean check
      • 1.13.X ¯_(ツ)_/¯
      • 1.14-20w18a recalculates the hitbox of the block below the rail every time
      • 20w19a-20w27a uses a simple boolean check for full cubes which decreased lag massively but still recalculates the collision box of non-fullCubes every time
      • 20w28a+ Caches if the rail can stay atop the non-fullCube

      Below are some testing results.
      I have a void world with 10,000 rails atop top-slabs running on a 2gt observer clock
      5000 rails update every gametick (half those turning on, half turning off)
      16 chunk render distance, 2gb of ram for the JVM

      The world ran at less than half an mspt when idle which was consistent across all versions.
      Each test was done a few times to get stable results.

      Version Client TPS MSPT Thumbnail
       1.12.2  Vanilla 24.69  40.5 
       1.13.0   Vanilla  12.23 81.75
       1.13.2  Vanilla  >20  <50
       1.14.4   Vanilla   5.55   180 
       1.15.2   Vanilla   5.37   186 
       1.15.2 Lithium 28.57    35 
      20w18a   Vanilla   4.85   206 
      20w19a   Vanilla   5.46   183 
      20w19a Lithium 30.3    33 
      20w28a  Vanilla 30.3   33

      Lithium heavily optimizes the shape comparison check:

      1. Simple full-cube check with early exit (which was added in 20w19a to decrease lag from rails only atop full cubes)
      2. Cache if the side of the block can support the rail (slabs)

      World Download: Rail Slab Update Lag 1.12.zip

        1. 1.12.2 Vanilla 20tps 40.5ms.png
          477 kB
          RedCMD
        2. 1.13.2 Vanilla 20tps 50ms.png
          641 kB
          RedCMD
        3. 1.13 Vanilla 12.23tps 81.75ms.png
          665 kB
          RedCMD
        4. 1.14.4 Vanilla 5.55tps 180ms.png
          540 kB
          RedCMD
        5. 1.15.2 Lithium 28.57tps 35ms.png
          685 kB
          RedCMD
        6. 1.15.2 Vanilla 5.37tps 186ms.png
          541 kB
          RedCMD
        7. 20w18a Vanilla 4.85tps 206ms.png
          594 kB
          RedCMD
        8. 20w19a Lithium 30.3tps 33ms.png
          631 kB
          RedCMD
        9. 20w19a Vanilla 5.46tps 183ms.png
          544 kB
          RedCMD
        10. 20w28a Vanilla 30.3tps 33ms.png
          618 kB
          RedCMD

            mgatland [Mojang] Matthew Gatland
            RedCMD RedCMD
            Votes:
            81 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: