mojira.dev
MC-132284

Upgrade paths for loading structure files are slow

The bug

When you try to load a structure, it updates all the Blocks and Palette(s) values if the DataVersion version is below the value of the version you're using. This upgrading is super slow. For a structure with a dimension of 32*32*32, it can take 20 seconds to 2 whole minutes. 

After the structure is loaded once, it loads fast again (presumably since the structure gets saved to memory, with remembers the updated version), but after you do /reload or after you leave and rejoin the world, it is slow again.

How to reproduce

You can use the datapack provided to load a structure from 15a, and a structure from 1.13-pre5 (they both have the same blocks/palette; they only include andesite blocks)

  1. Reload the world

  2. Run these two functions:

    function load:1.13-pre5
    function load:1.13-pre5

    as you can see, this is instant

    function load:18w15a
    function load:18w15a

    This takes ~20 seconds.

  3. If you run the second function again, it is instant until you do /reload

Attachments

Comments 8

Are you running the function in the air? If so, the lag might be caused by lighting updates. Running the function on the ground loaded the structure instantly.

@Neko no lighting issues aren’t the cause. As shown inthe videos I’m in a world completely filled with bedrock. Also, did you use the datapack’s structure and datapack’s function and not just a random one? Since I can always reproduce it with that datapack. (It’s also shown in the videos)

Yes I used the attached data pack and ran the function. It loaded fine for me.

That’s sl strange. The other people two people that tested the pack before I added it to this ticket were also able to reproduce, and I also probably have run that function around 30 times, and was able to constantly reproduce. Wouldn’t the video be enough of a confirmation?

@unknown Could you try joining the world, then doing /reload and then executing the function? It seems to be having to do with the DataVersion tag in the structure file. I think it tries to update all the blocks (by scanning through the block list) if the DataVersion value is below a certain value. If it's done that, it loads the structure and remembers the updated version (probably in RAM) and when you load it again, it works. When doing /reload it probably clears the structure from RAM which is why it lags again if you run the function again after /reload

I updated everything, this should now be 100% reproducable

Can confirm now. Thanks!

This seems to be fixed

AlexMCool

(Unassigned)

Confirmed

Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, ..., Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2-pre1, Minecraft 1.13.2-pre2

Minecraft 1.13.2

Retrieved