Bunch of microoptimizations to reduce dereferences and cache collisions.