SpigotMC/Spigot — pull request #225 by aikar (2014-08-31 04:09:05+00:00)
Title: Improve the Optimized Tick Loop patch

Reworks the catch up system so that it is more reliable, and only kicks in at > 2ms.
Kicking in less makes the system useless as sleep() is not precise enough.

Due to the precision of .sleep(), the system would oversleep on many occasions, causing us to lose TPS.

Ideally, the catchup system would account for that, but at such low precision, all attempts to "catch up" are then lost
by the same .sleep precision cause.

Additionally, the lastTick was being initialized to now, causing the server to essentially
wait for the first tick. It is now set to -1 tick to make first tick initiate immediately.

Then I have also increased the size of the catchup buffer so it has a better chance at keeping 20 TPS longer term.

Then Finally, I have added a new Bukkit.spigot().getTPS(); API to expose the recentTPS the server is tracking, so
that plugins may access it for graphing.