in reply to Re^11: appending to html at beginning (don't use CGI.pm)
in thread appending to html at beginning
You’re timing webserver responses… it’s hard to guess what’s up there.
Actually, my interpretation is pretty simple - using Plack in this way is necessarily more burdensome than not. The webserver response times everything from receiving the request to sending the response, ie: compilation, arg processing, handing the output back to Apache, etc. all of which might be faster or slower with one method or the other. The only surprise to me back then was the scale of the difference. I'd hoped for maybe just a factor of 2.
It’s also hard to measure such a trivial use meaningfully (it is like benchmarking “hello world”).
That's exactly why I did it this way (as alluded to above). With such a trivially simple script the differences in the runtimes should be as near as possible to the entire difference of using Plack versus not with no other complications. Obviously the percentage increase with Plack will reduce for scripts which do more but one can expect the mean penalty on my test rig to be about 70ms.
The advantage of quoting a percentage difference for a trivial script is that the percentage should be in the same area for anyone performing this test regardless of CPU speed, disk speed, etc. If I just said "it's 70ms slower" that would differ wildly from what others see.
Thanks very much for pointing out the possible use of Plack::App::WrapCGI. Unfortunately, if I run your sample script using the vanilla CGI script from my benchmark as the script argument to Plack::App::WrapCGI->new I get no output at all - not even any headers. I think this might be running it as a PSGI application which would then need further Plackage around it to turn it back into CGI? More reading required at this end, I fear.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: appending to html at beginning (plackup wrapcgi apache modperl registry)
by Anonymous Monk on Mar 03, 2017 at 10:26 UTC |