SpigotMC/Spigot — pull request #211 by aikar (2014-08-12 03:51:57+00:00)
Title: Optimize TileEntity Ticking

Re-organizes the servers TileEntity Tick List to be bucketed by chunks and type.

This allows the server to skip buckets of Tile Entities that is known to
not have any tick function (half of them), skipping time spent iterating
them and checking if they are valid and in a loaded chunk. In other words,
a lot of "meta" time wasted on tile entities that would never do anything anyways.

By also storing the TileEntity by chunks, we can check that a chunk is "valid" once,
and only iterate valid Chunks, skipping checking the chunks state for every TileEntity.

This cuts out a massive amount of checks revolving around TileEntity ticking.
Servers with large amounts of TileEntity should see significant improvement.

Finally, this then spreads out the ticking of reduced-rate TileEntities so that they
do not all tick on the same tick, distributing the load of some TileEntities like Chest.