Files: What is more efficient?
-
Suppose I receive raw data from a source. This source already placed it in memory for me and I only know the raw data doesn't exceed 10 megabytes. It's running on a computer with 512MB RAM or more.. What is more efficient if I want to write this raw data to a file : - Create a buffer of xxx bytes - Write the 10 MB to file at once :confused: -- Alex Marbus www.marbus.net But then again, I could be wrong.
-
Suppose I receive raw data from a source. This source already placed it in memory for me and I only know the raw data doesn't exceed 10 megabytes. It's running on a computer with 512MB RAM or more.. What is more efficient if I want to write this raw data to a file : - Create a buffer of xxx bytes - Write the 10 MB to file at once :confused: -- Alex Marbus www.marbus.net But then again, I could be wrong.
-
What format do you want the data in? ASCII or just a proprietary serialization? - Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
ASCII, actually it's always plain text (well, some Base64 encoding might be there but that's text after all :)) -- Alex Marbus www.marbus.net But then again, I could be wrong.
-
Suppose I receive raw data from a source. This source already placed it in memory for me and I only know the raw data doesn't exceed 10 megabytes. It's running on a computer with 512MB RAM or more.. What is more efficient if I want to write this raw data to a file : - Create a buffer of xxx bytes - Write the 10 MB to file at once :confused: -- Alex Marbus www.marbus.net But then again, I could be wrong.
I'd say just write the whole thing at once and let the OS's caching code worry about how best to write it out to disk. --Mike-- Friday's GoogleFight results: Britney Spears 2,190,000 - Erica Weichers 23 :( 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm
-
I'd say just write the whole thing at once and let the OS's caching code worry about how best to write it out to disk. --Mike-- Friday's GoogleFight results: Britney Spears 2,190,000 - Erica Weichers 23 :( 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm
Thanks, Mike.. that was actually the answer I wanted to hear :) -- Alex Marbus www.marbus.net But then again, I could be wrong.