With a scripting language like python (or php), things are not compiled down to bytecode like in .net or java.
So does this mean that on every request, it has to go through the entire application and parse/compile it? Or at least all the code required for the given call stack?
Wrong: everything you
import
in Python gets compiled to bytecode (and saved as.pyc
files if you can write to the directory containing the source you're importing -- standard libraries &c are generally pre-compiled, depending on the installation choices of course). Just keep the main script short and simple (importing some module and calling a function in it) and you'll be using compiled bytecode throughout. (Python's compiler is designed to be extremely fast -- with implications including that it doesn't do a lot of otherwise reasonable optimizations -- but avoiding it altogether is still faster;-).