On 16 Feb 2005, at 17:40, Jay wrote:
On Wed, 16 Feb 2005 08:13:02 +0000, Ken Gillett <[EMAIL PROTECTED]> wrote:
As an extension to my question, what about when repeatedly adding to a
data set that needs to be written to a file? Will it be quicker to
write each line directly to the file, or repeatedly add to a variable
then write that to the file in one hit?
My guess is that this will have a more definitive answer since the
speed difference between writing to a variable and writing to a file
will make it a more obvious outcome and indeed my experience indicates
that writing to a file is measurably slower. But does anyone have any
in depth knowledge of these processes.
Ken,
Again, it will really depend. How "big" is the hit going to be? Big
enough that storing the data in memory will eat up your RAM and force
you to swap? If you're dealing with thousands of lines, you may not
want to store them all in memory, especially if you're like me,
running a database server on a PII/133 with 16M of RAM. On the other
hand, if you're on a brand new P4 with 2G of DDR2, who really cares?
Of course if your data set is multiple terabytes, even 2G isn't going
to be enough.
OK, not as clear-cut as I thought. Bit more trial and error required.
Thanks.
Ken G i l l e t t
_/_/_/_/_/_/_/_/_/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>