[MRG] Fix test python 2.4 and faster opt

NEWS.txt:
- Speed up the optimization phase during compilatin (Frederic B.)

Not news.txt
- Fix a tests in python 2.4 due to an import
- more profiling, error info