Runtime optimisations

Commit 6102144 introduced a very significant performance regression for weave, because it created a new code string (adding the compiler options etc. to it) at every time step. This branch fixes this (by moving it to `__init__`) and also adds some other small performance improvements that were easy to do.

Ready to merge from my side, all the tests pass.