Optimize CPU intensitive Compiler methods

This commit contains some performance optimizations in methods
that showed up as very time consuming in the profiler when running
the rake following rake tests:

benchmark:many_modules:run
benchmark:defined_types4:run
benchmark:defined_types:run

CPU consumption with this patch in place is between 70% - 75% of
what it used to be.

Profiling was performed using stackprof
https://github.com/tmm1/stackprof
That makes sense.