Some minor perf refactoring in the compiler.