Inefficient dragon respawn
Timings or Profile link
https://spark.lucko.me/yEwDSXG6Yk
Description of issue
After placing the fourth end crystal when respawning the ender dragon on the latest version of paper with only spark installed, a lag spike happens from the method net.minecraft.world.level.dimension.end.EnderDragonBattle.findExitPortal(). The timing link has a threshold of 100ms per tick, so it only captured the tick where the spike occurred.
Plugin and Datapack List
plugins [17:14:22 INFO]: Server Plugins (1): [17:14:22 INFO]: Bukkit Plugins: [17:14:22 INFO]: - spark datapack list [17:14:24 INFO]: There are 2 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)] [17:14:24 INFO]: There are no more data packs available
Server config files
https://paste.gg/p/anonymous/64cefa9fd53943738dae4a435cce823f
https://paste.gg/p/anonymous/535e23161f594ff5a7d89aba428eaf7b
https://paste.gg/p/anonymous/1368ee80df46428680618c1cf190d2cf
https://paste.gg/p/anonymous/6c773eff0b734515b7715b995e545577
https://paste.gg/p/anonymous/c35ba578670e488db1fbf0882ebd1a33
Paper version
version [17:13:40 INFO]: Checking version, please wait... [17:13:41 INFO]: This server is running Paper version git-Paper-450 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 62b220a) You are running the latest version Previous version: git-Purpur-2155 (MC: 1.20.4)
Other
After testing, the lag spike is caused by the server checking for the end portal formation from the highest placed block at 0,0 to the bottom of the world in a single tick, which takes longer than 100ms (usually anywhere from 800-2500). I think major refactoring might have to be done to fix this, although just making the search algorithm more efficient could also be an easier fix.