Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I'm doing some research on how I can optimize our Perl application. It's fairly large (100k lines). I've ran both dprof and NYTimes to try and fix some of the outliers, but we think that there are some things we're not seeing (based on the output).

If anyone can comment on the following, we'd greatly appreciate it.

First, some background: Our application is separated into many libraries (almost 1k) and within those libraries, many many methods (over 3k total).

1. We found this: http://www.perl.com/pub/a/2000/06/dougpatch.html ... (we realize this is very old, and things have probably changed, but I'd better ask)... We're worried that method call overhead isn't taken into account in any of our profiling runs. I couldn't find any resolution to this thread either. If anything, we'd gladly take a pragma to lock in inheritance to get the performance boost. We call a LOT of methods in our system, if we can make calling them faster, it would make a difference.

2. We're using "fields", since we desperately need compile time safety for attribute lookups, and I'm told that it's faster than using a hash directly, because they become array lookups. We're researching the move to Perl 5.10 as well, because of a purported speed boost as well as a decreased memory footprint. Lastly, we heard that there is a change to fields past 5.9, and 5.10 has a "new" way of doing this type of stuff altogether, but I haven't seen any benchmarks or documentation detailing the implementations and any rationale for using/not using them.

3. We use SWIG to talk to shared memory. Does anyone have any idea the difference in performance between hand rolling XS over SWIG for reading attributes off a C Structure? (or is there some even "better" way to do this kind of thing that I've never heard of?)

4. I read the section of perldoc concerning inline functions. I'm a little confused, you can't have an inline function if it has any arguments? I need to run some benchmarks of my own on this, but it's not something I see mentioned in any of my Perl books. (Is memoization of a method call even possible?)

Update:

The dprofpp -r produced some interesting results (1.5 hours of data collected).

  • IO::Select was #1 with 62% of our cpu utilized (makes sense, we're an event based program that uses sockets to get information. It does bring up the question about whether EPOLL should be considered as an alternative).
  • SWIG was #2 with roughly 3.5%. Ouch. I hope the XS really does make that big of an improvement
  • fields::__ANON__ ate 1.3% of the time. I don't know if this is the constructor or the penalty we pay when accessing attributes (help?!)


Based on this, we definitely have some more work to do. Thanks to everyone with their insight on the issue.

In reply to Optimizing a large project. by dextius

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-24 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found