Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: suggested module/tools to automatically "tighten" my perl

by davido (Cardinal)
on Jun 22, 2012 at 01:54 UTC ( [id://977745]=note: print w/replies, xml ) Need Help??


in reply to suggested module/tools to automatically "tighten" my perl

The order of operations when it comes to speed optimization:

  1. Actually notice that there might be a performance issue.
  2. Profile to find where the issue is focused.
  3. Research the options with respect to algorithms that might improve upon the performance of the hotspots discovered in profiling.
  4. Benchmark the various algorithmic options.
  5. Implement the better algorithm.
  6. Test the implementation to ensure you haven't regressed in some way.
  7. If there's still an issue, repeat step 2.

If there's no better algorithm, then it's time to trim cycles (paraphrasing Tom Duff).

You mentioned CGI, and you are correct that many have discovered (probably through profiling) that the startup cost of CGI is high, particularly for short-running scripts (which CGI usually entails). This is one area where the profiling's been done again and again, there is a better algorithm, and the better algorithm is known. The better algorithm for that scenario is to eliminate the repeated start-ups. This can be done with something like mod-perl, or more modernly, through a persistent application framework that sits on top of a back-end like mod-perl, FastCGI, or some other persistent daemon. The modern frameworks such as Dancer, Catalyst, and Mojolicious attempt to do this (and much more).

To summarize, if you have determined that startup time is your foe, the effectiveness of the micro-optimization of trimming cycles from startup pales in comparison to the algorithmic optimization of moving the startup cost out of the individual request cycle by creating a persistent process.


Dave

  • Comment on Re: suggested module/tools to automatically "tighten" my perl

Replies are listed 'Best First'.
Re^2: suggested module/tools to automatically "tighten" my perl
by abcperl5 (Initiate) on Jun 22, 2012 at 04:32 UTC

    Thanks everyone for their suggestions; I'll look into it and report back.

    I would love to switch from CGI to a persistent setup. Everything runs on IIS on Windows 2003. Has anyone actually gotten FastCGI to work properly with Perl on Win2003/IIS? If so, I would love to hear it and get a pointer to any docs/downloads.

    I spent many hours investigating this, and it seemed that FastCGI didn't work on Win2003 (and I could never get it to work on Win2008 either). But I never posted to forum directly about it...

      Have you had a look at any of these (in particular the second link)?

      It seems like you've given this some thought -- done your due diligence. That's great. If the second link I provided helps, you should be able to, from there, get PSGI/Plack going, and that opens up a lot of possibilities for simplifying your life.


      Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://977745]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found