Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Brethren,

I have recently begun the journey to CS enlightenment, with all its algorithm efficiency, holy "O" notation, and other joyous wonders1. I have encountered a wall of thorns along this path.

At the moment I'm working with sort functions that need to read data from the disk, sort, then store back to the disk. Various constraints and data sets are provided, sometimes you have to have fit a sort into $i Mb or have it run under $j seconds2. Prior to this I was happily using Benchmark, however the new memory considerations preclude its use as the sole tool. Checking CPAN's Devel and other packages turned up nothing that dealt with memory profiling. After reading a bit more into Perl’s memory management, reference counting, garbage collection, and general recycling... it became apparent how naïve I was in this respect. A straight comparison inside the same runtime interpreter would have produced incredibly skewed results anyways.

This leaves me where I am now, concerned with relative performance in memory, speed, and scratch space between scripts yet with no overall way to compare. I'd guess some type of fork() call w/ IPC or an external framework are needed but I'm only beginning programming so these are, for the moment, well beyond my ability to write.

I ask unto ye, are there readily available tools for doing these comparisons?

-- Brother Arguile


1 I realise Perl is not considered by some to be the ideal language to learn this in, but I have to balance my immediate professional needs with the time consuming theoretical material. It simply doesn't make sense to jump into Scheme or C/C++ full force at this time.

2 At this point I'm not so concerned with absolute limits as relative performance.


In reply to Benchmarking with Memory Profiling by Arguile

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 surveying the Monastery: (4)
As of 2024-04-24 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found