I think you would have to dig into the code to figure that one out. but no matter how mant times i read this, i cant think of any practical reason to even use that information if you had it
if you dont mind me asking.. why do you want to know?
I know it's minuscule but which is faster @a or @p in circumstances where both work?
My guesses:
testfor @a
Looks at all players
Executes for each
testfor @p
Looks at all players
References relative position
Executes for one
Am I correct in assuming @a would use a tiny bit less resources?
The @a and @p selectors both pool together all targets based on distance first. Using @p simply grabs the first from that list. There is essentially no difference between the two in selector processing alone, except that @a can obtain dead players.
In general, a selector's processing performance will typically not be as impacting as the command's processing performance. Most commands are processed multiple times, equal to the number of targets obtained by a selector. If you don't need to have /testfor iterate many times, then @p will suffice (or @a[c=1] if you need to include dead players).
I know it's minuscule but which is faster @a or @p in circumstances where both work?
My guesses:
testfor @a
Looks at all players
Executes for each
testfor @p
Looks at all players
References relative position
Executes for one
Am I correct in assuming @a would use a tiny bit less resources?
I think you would have to dig into the code to figure that one out. but no matter how mant times i read this, i cant think of any practical reason to even use that information if you had it
if you dont mind me asking.. why do you want to know?
If Someone Is Helpful, Please Remember To Thank Them By Hitting The Green Up Arrow
The @a and @p selectors both pool together all targets based on distance first. Using @p simply grabs the first from that list. There is essentially no difference between the two in selector processing alone, except that @a can obtain dead players.
In general, a selector's processing performance will typically not be as impacting as the command's processing performance. Most commands are processed multiple times, equal to the number of targets obtained by a selector. If you don't need to have /testfor iterate many times, then @p will suffice (or @a[c=1] if you need to include dead players).
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/