Benchmarking with Memory Profilingby Arguile (Hermit)
|on Jun 10, 2001 at 06:42 UTC||Need Help??|
Arguile has asked for the
wisdom of the Perl Monks concerning the following question:
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.