P is for Practical | |
PerlMonks |
Re^4: perl ST sort performance issue for large file? (copying)by BrowserUk (Patriarch) |
on Mar 30, 2012 at 17:19 UTC ( [id://962655]=note: print w/replies, xml ) | Need Help?? |
That still involves an extra copying of each record. For long records, I've certainly seen that add up to a performance problem ... On my platform at least, copying the records through a single buffer -- thus not incurring the need to request extra memory from the OS for that particular part of the operation -- doesn't seem to incur much of a penalty. On a fairly modest, 50MB/1e6 record file:
Doing the GRT in 3 stages:
Takes 7 seconds and just under double the amount of memory required by the original array:
Doing it with your original formulation unmodified, but excluding the initial time to load the array from the equation:
The sort takes 30 times longer and 4.5times as much memory as the original array:
Most of that time is spent going to the OS over and over to expand the stack piecemeal to accommodate the lists as they expand. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|