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

Redstone dust updates cause lag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.8.7, Minecraft 1.10.2, Minecraft 16w41a, Minecraft 17w18b, Minecraft 1.12.2, 1.14.4, 19w42a, 1.15.2, 20w12a, 20w21a, 1.16 Pre-release 5, 1.16.1, 20w27a, 20w29a, 20w30a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4 Pre-release 1, 20w49a, 1.16.5, 1.17 Pre-release 1, 1.17, 1.17.1 Pre-release 1, 1.17.1, 21w39a, 21w44a, 1.18.1, 23w07a, 1.21
    • Confirmed
    • Performance, Redstone
    • Important
    • Platform

      Redstone dust causes immense amounts of lag on servers (including local SinglePlayer "servers"), and here's why (deduced from the game code, as well as a mod I wrote to help track down some redstone querks):
      Except for a redstone dust block updating (at least) 23 blocks around it, every time it is placed or receives any sort of update, apparently, redstone dust also DOES NOT directly de-power, as you'd expect. Instead, it continually loses 1 signal strength until it's "satisfied" and a check fails, meaning it doesn't need to update anymore. The 15 signal strength levels it needs to lose (one-by-one, mind you), each time causing at least 23 block updates, all happening within 1 gametick (1/20th of a second, around 15 * 23 = 345 block updates in total) cause a lot of unnecessary calculations to be done. Not only that, but this example only involved one piece of redstone dust. Imagine the same happening with a line, or even a grid. There it's even worse, since the dust blocks update each other again and again multiple times in 1 single game tick, so that a line of 15 redstone dust can easily amount to around 2,500 block updates in total.
      Each calculation is independently quite quick and simple, but any calculation run 2,500+ times in a 1/20th of second, where a lot of other calculations also need to run in that short time frame, is heavy, to say the least.

      I suggest rewriting the redstone dust update code, as it is quite simple and will reduce a whole load of lag on any server with redstone clocks running.
      Redstone dust is a horrible lag causer, and it does so in one of the most unnecessary ways in the entire game.

      Here is a short clip demonstrating (using my mod, as mentioned above) how 1 piece of redstone dust alone causes 15 * 23 = 345 block updates when de-powering:
      https://www.youtube.com/watch?v=T3bST3JGgas

      Final note: The "Affected Version/s" field only allows set versions, and only the most recent ones, however, this "bug" has existed ever since redstone dust was added to the game, all the way back in Alpha 1.0.1.

      Possible solutions

        1. 1.9 Performance.mp4
          9.10 MB
          Meri Diana

            Unassigned Unassigned
            Sharir Sharir
            Votes:
            350 Vote for this issue
            Watchers:
            124 Start watching this issue

              Created:
              Updated:
              CHK: