Hacky adaptive throttling of the main loop.