-
Bug
-
Resolution: Fixed
-
1.20.5 Pre-Release 1
-
None
-
Confirmed
-
Commands, Performance
-
Important
-
Platform
When an item with a lot of data is in your inventory, the act of simply checking the player's NBT data causes a lot of lag.
In the example I give in the reproduction steps, the data pack uses three very simple execute if data commands every tick, which in combination with a book with about 250 pages of data in your inventory, makes the game nearly unplayable. This was not the case in 1.20.4, where you can't even tell the difference.
How to reproduce:
- Create a world in 1.20.4 and include attached the data pack.
The data pack includes a ticking file with the following code:execute if data entity @p warden_spawn_tracker execute if data entity @p warden_spawn_tracker execute if data entity @p warden_spawn_tracker
- Measure the ms/tick when you don't have anything with a lot of data in your inventory.
- Give yourself a book with a lot of data, by doing /loot give @s loot namespace:old
- While holding the book, compare the ms/tick to how it was before. There shouldn't be any noticeable difference.
- Create a world in version 1.20.5-pre1 and repeat steps 1-2.
- Give yourself a book with a lot of data, by doing /loot give @s loot namespace:new
- Notice how the ms/tick now spikes and causes significant server lag. It's amplified even further while holding the item, most likely due to SelectedItem existing when doing so.
These are the results I got when testing:
1.20.4 | 1.20.5-pre1 | |
---|---|---|
No book in inventory | ~7 ms/tick | ~5 ms/tick |
Book in hand | Still ~7 ms/tick | ~50 ms/tick |