The stupid question is the question not asked | |
PerlMonks |
Re: File slurping efficiencyby KM (Priest) |
on Aug 11, 2000 at 22:20 UTC ( [id://27565]=note: print w/replies, xml ) | Need Help?? |
I just did a quick test of opening a small file 500 times using method A, then grepping, and method B and using a match. Results of my benchmark:
Method A:
Method B: Results may vary, try it yourself to see what you get. Not very surprising since Method A will need to populate an array, the loop through it and match. Method B just does the match.
UPDATE: Out of curiosity I did Method A withought building an array and simply grepping from the open filehandle. Small difference:
Cheers,
In Section
Seekers of Perl Wisdom
|
|