Improved performance of CompiledTreeRouter, especially under PyPy.

Using the locals() scope came with a performance penalty. Furthermore, compiling
code in a function and then executing it as any other function provided another
performance boost. These two changes combined and the PyPy CompiledTreeRouter
blows everything else out of the water.