Arman's stuff
Guest
Speeeeedy!

(Thu Jul 2 16:46:30 2009)

I would like to say that Perl is really, really awesome. Really.

Using the already-present-in-perl switch "-d:DProf", and the accompanying program "dprofpp," I was able to determine the following:


Total Elapsed Time = 5.875003 Seconds
User+System Time = 5.195003 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
32.8 1.706 2.874 10803 0.0002 0.0003 Text::Balanced::_match_variable
32.8 1.705 3.729 7683 0.0002 0.0005 Text::Balanced::_match_codeblock
19.8 1.029 1.070 7315 0.0001 0.0001 Text::Balanced::_match_quotelike
6.31 0.328 5.063 52 0.0063 0.0974 Switch::filter_blocks
5.47 0.284 0.284 21935 0.0000 0.0000 Text::Balanced::_failmsg
2.87 0.149 0.296 13 0.0115 0.0228 main::BEGIN
0.96 0.050 0.050 1 0.0500 0.0500 Image::Magick::bootstrap
(truncated)

If you notice, the script takes 5.875 seconds to run. That's almost forever, in computer terms; almost 6 seconds before a user can even START to download his page! That's terrible! It also point out exactly which part of my site is running so slowly... Furthermore, more than 90% of that tiem is taken up by the "Text::Balanced" module! "Wow," I thought. "If I could get rid of that, I'd have my timing problem beat!"

After a little searching on Google, I found that the Switch module references Text::Balanced - and that's the only one that does. As you can see from above, the switch module takes another 6.31% of the time - if I could get rid of it, I could save about 97% of the execution time! And thus, after no more than a few minutes of swapping out switch/case statements for if statements, I got the following reading:


Total Elapsed Time = 0.354187 Seconds
User+System Time = 0.344187 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
34.8 0.120 0.257 12 0.0100 0.0214 main::BEGIN
11.6 0.040 0.040 1 0.0400 0.0400 Image::Magick::bootstrap
(truncated)


Hot diggity dog! (Do people say that anymore?) Not even half an hour's work, and I cut run time from 5.85 seconds to 0.35 seconds. Chopping 5.5 seconds off run time is amazing, especially for a web page. So, I'll bet you that things will go a little faster. There's still work to be done, of course, but the main lag has been dealt with. I'm not sure what's causing the next piece of lag, but I'm thinking it's either how I set up the server, or how the DNS takes care of my address...

<< MetablaggingAnother test blag >>

This blag is tagged: Blag, Perl, All