Hi all, I have a program where I need to iterate through a binary file many times, and where each binary data needs to be processed each time. I use something like:
read(f, data); { process data } seek(f, filepos(f)-1); write(f, data);
My program seems to spend a lot of time on file I/O, so just for fun I tried to remove the seek (of course the program now gives crap, but anyway :-)). This speeded it up by a factor of 4-5!
Now, I *could* just use two files and swap these once per iteration, but since I have a lot of these files this would really be a mess. Can anyone tell me why it's so slow, and what may be done to speed it up? Isn't Linux also supposed to have a very efficient file-cashing system, so the above shouldn't really be problem?
Best regards
Preben Bohn´
===== This message has been made up using recycled ideas and language constructs. No plant or animal has been injured in process of making this message.
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com