At 12:28 PM 10/25/2004 +0100, Paul Herring writeth:
>
>From: el Padre [mailto:[EMAIL PROTECTED]
>
>>Hi all,
>>
>>I need to read the whole content of a file in a string object.
>
>Why do you need to read the whole file in?

Probably because it is easier to parse the whole thing than little teensy
bits and pieces.  And it can be faster.  _MUCH_ faster (I've run tests that
prove this to be true).  That, of course, assumes the OS doesn't have to
use swap space to get that type of performance.  However, the moment you
hit swap, you lose whatever performance you might have gained and a lot
more.  For small files (e.g. under 25MB on a machine with 384MB RAM), this
is fine, IMO, as long as the program doesn't need the memory for more than
a few seconds.  For anything larger or for longer-term processing, consider
another route.

You could also use non-portable memory mapped files.  It simulates having
the whole file read in without using the memory until first referenced.
This type of feature is generally OS-specific, so you'll have to read your
compiler's/OS' documentation.


Thomas J. Hruska
[EMAIL PROTECTED]

Shining Light Productions
Home of the Nuclear Vision scripting language and ProtoNova web server.
http://www.slproweb.com/





To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=315388.5526708.6599542.3001176/D=groups/S=:HM/A=2372354/rand=750257303


Yahoo! Groups Links

Reply via email to