mojira.dev
MC-269212

Worse performance with "execute unless tag" compared to "execute if !tag"

Example video (1.21rc-1): https://youtu.be/TByzwsQTj_A

Note:
I will be referencing "execute if entity @s[tag=Test]" as "function test:if" and "... if entity @s[tag=!Test]" as "test:if_not". Same for "unless". These are the names of the functions in the example datapack that include their respective command copy pasted 40,000 times.

How to reproduce:

  1. Install the attached data pack in your world

  2. /reload

  3. Place a repeating command block with "execute as @p run function test:if_not"

  4. Observe the MSPT in the F3 menu (Also try giving yourself the "Test" tag with "/tag @s add Test")

  5. Change the command to "execute as @p run function test:unless"

  6. Observe the MSPT again, and again give and remove the "Test" tag to see how the MSPT changes

Observed result:
You'll see that when running the test:unless function, the MSPT are lower than with test:if_not when you don't have the tag, but way higher if you do have the tag
(See attached images)
If the executing entity doesn't have the "Test" tag, "test:unless" is faster than its "test:if_not" counterpart. 

[media]

However, if the executing entity has the "Test" tag, "test:unless"'s performance impact skyrockets and is unexpectedly almost twice as slow.
This means that "if" and "if not" will be faster than the "unless" subcommand that was specifically made for this. 

[media]

Expected result:
"test:if" and "test:unless_not" behave the same and should thus have a comparable performance impact
"test:if_not" and "test:unless" behave the same and should thus have a comparable performance impact

TLDR:
If the condition of the subcommand fails, there's a performance cost.
But specifically for "execute unless", the performance cost when it fails is so big that using "execute if not" becomes almost twice as fast.

Attachments

Comments 3

We do not have enough information to find the cause of this issue.

Please record a video of this happening and attach it to this report.
If you are on Windows, you can use Windows+Alt+R to open a built-in app for recording game footage.
If you are on Mac (Mojave or later), you can use Shift+Command+5 to open a built-in app for recording your screen.
In case you don't have a program to record videos, we recommend using the free recording software OBS.
In case the resulting video file is too large to be uploaded to the bug tracker directly, please upload it elsewhere (e.g. as unlisted video on YouTube) and link to it here.

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

Thanks for your inquiry. I have attached the desired video. I hope this clears up any confusion caused by my questionable skills at explaining things.

Thank you for your report!
After consideration, the issue is being closed as Invalid.

This report does not describe a bug.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

SilicatYT

(Unassigned)

Confirmed

Performance

1.20.4, 24w10a, 1.21, 1.21 Release Candidate 1

Retrieved