Minor optimizations

Looking through some oprofile results I discovered a few lines that were getting hit with a lot of samples and which could be trivially improved.

The performance improvement is likewise trival (fractions of a percent) so let's only merge this if others agree the code is still clear.