Performance optimizations

Reduces fannkuch.py runtime on my machine from 25.5 secs to 16.5 secs.