I've been working on a dungeon generator for a while. Recently I noticed, that big commands on impulse (or chain impulse) command blcoks sometimes don't apply instantly. For example I'm executing a command with multiple execute-detects on... about 1024 armor stands, and it makes the activation button stay pressed for much longer than it should be (about 10 sec). I wonder if anyone knows how exatctly it works, and how it affects other command blocks in the world and in the chain.
It's server lag; the server is given a huge amount of work and it will take longer to finish the job, which causes most things to grind to a halt until it's finished.
The command parser will separately execute a command for each individual target obtained by a selector.
For example, when running the following while there are 1024 armor stands:
/execute @e[type=ArmorStand] ~ ~ ~ /testfor @e[type=ArmorStand]
There are 1024
/execute commands being processed, and then for each and every
/execute command processed there are 1024
/testfor commands processed (totaling 1,048,576 commands processed). This is an extremely large amount of work that needs to be done, and it's only a single
The more nested executes you use, the worse off it's going to be. Not only do the commands have to be processed thousands of times, the selectors do as well (which comes with some heavy operations, such as sorting all targets by distance before picking from them).