/clear command has severe performance drops (increased mspt) after replacing inventory slots with identical items. The lag persists until you reconnect to the world or clear and re-grant the affected items. Following the reproduction steps below results in roughly an 6.77x increase in mspt.
Not all commands that overwrite identical items seem to cause this issue. The exact root cause and full scope of affected cases are currently unknown.
For counting items, /execute if items can be used as a temporary workaround.
Steps to Reproduce:
Create a new void superflat world.
Change the gamemode to survival.
Run the following command to fill the inventory with items:
/loot replace entity @p contents loot {pools:[{rolls:1,entries:[{type:tag,items:"#logs"}]}],modifier:[{type:set_count,count:64},{type:set_custom_data,tag:{a:1,b:2b,c:{c1:aaaaaaaaaaaaaaaaaa,c2:[a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a]}}}]}Set up a repeating command block to count items 1024 times per tick using
/clear.
(For example, summon at least 4 entities into the world and put the following command into the command block):/execute rotated as @e[limit=4] rotated as @e[limit=4] rotated as @e[limit=4] rotated as @e[limit=4] rotated as @e[limit=4] run clear @a * 0Fill your inventory again with the same items using the same
/lootcommand (from step 3), and observe the sharp increase in lag (with the F3+2 graph).
Linked issues
relates to 2
Attachments
Comments 2
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
Thank you for helping us improve Minecraft! We saved your files: