The big speed boost you get with mod_perl over traditional CGI isn't really in the execution speed of the code. It's in the fact that the webserver doesn't have to start a new Perl interpreter and compile the script for each CGI request. So "mod_perl code" doesn't, in one good sense, run any faster than the code outside mod_perl. For fine-tuning your code, you probably want to use a combination of Benchmark and something like Devel::DProf. (note: that will only help you test out the efficiency of various algorithms; but since the integration of Perl and Apache that is mod_perl is a different environment from that of traditional CGI , it's not so obvious that you'll be able to port conclusions about how fast this script is as traditional CGI to how fast it will be under mod_perl directly; mod_perl is much more powerful than traditional CGI, which is a reason to use it independent of any speed gain)
Given that mod_perl is helping you serve web pages, the best way to measure it is to simulate an actual setup and see how it deals with it. Write a script that uses LWP to make requests to the server, and see how many pages it can serve up in a given interval. That's probably the only way to test the relative speed of mod_perl vs. say, PHP or JSP or ... $dynamic_web_content_technology
HTH
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
|