|
|
| We don't bite newbies here... much | |
| PerlMonks |
Re: Performance Trap - Opening/Closing Files Inside a Loopby tachyon (Chancellor) |
| on Dec 10, 2004 at 04:44 UTC ( #413752=note: print w/ replies, xml ) | Need Help?? |
|
If you have the memory something this will probably be faster. You can save on the if/else for every line as well as only doing the minimum in the loop (like not splicing and joining when we don't really need to). Even a saving of a few microseconds X millions of lines is substantial. Multiple calls to print are significantly slower than a single call as the OS can buffer/write more efficiently.
cheers tachyon
In Section
Seekers of Perl Wisdom
|
|