Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-139609

Performance of /tag command is abysmal


    • Icon: Bug Bug
    • Resolution: Fixed
    • Beta, 1.18.10
    • Beta, Beta, 1.17.11 Hotfix
    • None
    • Confirmed
    • Windows
    • 627199

      The bug

      The performance of the /tag add and /tag remove commands is exceedingly poor, so bad that you can easily crash a server using them.


      The performance of these commands is inversely proportional to the number of unique tags that any entity has had this session. That means that when you freshly open the game, and no entities have tags, /tag performs decently. Every time you add a "new" tag to an entity that hasn't been seen before this session, the performance of subsequent /tag commands gets worse.

      It gets bad, fast. If there are no tags in the world, adding and removing the same tag repeatedly can be done thousands of times per tick. But if a single entity somewhere has 500 unique tags, doing the same thing will instantly kill the server.

      How this is even possible, I don't know. Tags should just be a per-entity hash set, and extremely efficient. Currently, tags are far less efficient than scoreboards, despite having strictly less associated information.

      How to reproduce

      1. Download and open the attached world
      2. Follow the instructions on the signs

            tryashtar [Mod] tryashtar
            11 Vote for this issue
            5 Start watching this issue