Mojira Archive
MCPE-162190

/give is slow when no target is found

The bug

The /give and /replaceitem commands are slow even when no players are found by the selector. They're especially slow when the specified item has a lot of components, even though there was nobody to even give the item to, so no item should be generated.

How to reproduce

  1. Download and open the attached world
  2. Pull the levers next to the command blocks (the two marked with blue concrete are the most important), one at a time
  3. Observe the server performance for each:
    • The one on the left tries to give a sword to a non-existent player, 30,000 times per tick
    • The one on the right tries to execute as a non-existent player to give themselves a sword, 30,000 times per tick

Expected behavior

Server performance is identical

Observed behavior

Left command blocks tank the server, right slows it only a bit

Fixed

[Mod] tryashtar

2022-09-12, 11:46 PM

2024-04-23, 07:15 PM

2024-04-23, 07:15 PM

5

2

Confirmed

1177623

1.19.70.23 Preview, 1.19.22 Hotfix, 1.20.51 Hotfix

1.20.80.22 Preview, 1.20.80