Reduce memory allocation in the main loop

A few final tweaks for reducing memory allocations in the main game loop. This is the last of the easy stuff on the memory side of things. I don't think there are any more particularly easy wins to be had just from tweaking individual functions sadly.

On the plus side, things have improved enough that the GC is doing a fairly light amount of work now, so that's nice.
We've been moving style-wise towards adding braces to all outer blocks if an inner block has braces, but this rule isn't uniformly applied through the code yet.