views:

56

answers:

2

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?

+3  A: 

When running as CGI, yes, the entire project needs to be loaded for each request. FastCGI and mod_wsgi keep the project in memory and talk to it over a socket.

Ignacio Vazquez-Abrams
+4  A: 

With a scripting language like python (or php), things are not compiled down to bytecode like in .net or java.

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;-).

Alex Martelli