|go ahead... be a heretic|
Am I right to say that because the code in Modole2 persists between responses, calling the subroutine is faster than if it were plain CGI?
Yes, its faster because the module is already loaded and ready to run, no time needs to be spent on loading it
CGI starts a new process for each HTTP request, so program/modules/loaded, then program ended, memory freed
This takes time. Compilation takes time, finding the modules, loading the modules, allocating memory ... freeing memory all take time.
So for 1000 requests CGI takes , if it takes 1 second for program/modules to load/unload, and 1 second to run, that is half the time spent just loading/unloading the program, 2000 seconds total
To a user of your website, this translates to a slow website. It doesn't matter if you and your users have super fast internet connections, if you're running a load balancing proxy... if your HTML is optimized to render quickly and your program is super fast, its always going to take at least 1 extra second for every single request
With FastCGI, its 1001 seconds, 1000 seconds for 1000 HTTP requests, and 1 second to load the program/modules once
To put another way, boy/girl-scouts/pioneers are taught not to walk with their knives or leave them laying around but to stow-away their knives (back into the sheath) when they're not cutting -- basically like CGI -- great for safety , acceptable when responsiveness isn't a priority
But this wouldn't work for a chef, it would be way to slow. Which is why a chef has a work-space with a chopping block to leave his knife -- knife comes out of the sheath at start of day, and only goes back into sheath at the end of the day -- this is FastCGI