Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Files: What is more efficient?

Files: What is more efficient?

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpperformance
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlexMarbus
    wrote on last edited by
    #1

    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.

    N M 2 Replies Last reply
    0
    • A AlexMarbus

      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.

      N Offline
      N Offline
      Nitron
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • N Nitron

        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

        A Offline
        A Offline
        AlexMarbus
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • A AlexMarbus

          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.

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          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

          A 1 Reply Last reply
          0
          • M Michael Dunn

            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

            A Offline
            A Offline
            AlexMarbus
            wrote on last edited by
            #5

            Thanks, Mike.. that was actually the answer I wanted to hear :) -- Alex Marbus www.marbus.net But then again, I could be wrong.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups