mojira.dev
MC-182868

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

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 

[media]

 1.13.0 

 Vanilla 

12.23

81.75

[media]

 1.13.2

 Vanilla

 >20

 <50

[media]

 1.14.4 

 Vanilla 

 5.55 

 180 

[media]

 1.15.2 

 Vanilla 

 5.37 

 186 

[media]

 1.15.2

Lithium

28.57 

  35 

[media]

20w18a 

 Vanilla 

 4.85 

 206 

[media]

20w19a 

 Vanilla 

 5.46 

 183 

[media]

20w19a

Lithium

30.3 

  33 

[media]

20w28a

 Vanilla

30.3

  33

[media]

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: 

[media]

Linked issues

Attachments

Comments 7

RedCMD

Relates to MC-174568

Iosiv Visokogorskiy

Can confirm 1.16 pre release 4

Ray

in 1.16RC1

Iosiv Visokogorskiy

Can confirm for 1.16.1

Iosiv Visokogorskiy

Can confirm for 20w27a

Humiebees

fixed

mgatland

@unknown thank you for the test world and benchmarks!

RedCMD

mgatland

Confirmed

Performance

lag, performance, rail, slab, tps, transparent-block

1.15.2, 20w19a, 1.16 Pre-release 2, 1.16 Pre-release 5, 1.16 Release Candidate 1, 1.16, 1.16.1, 20w27a

20w28a

Retrieved