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.
- Download and open the attached world
- Follow the instructions on the signs