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#
  4. Reading large quantity of data from a file

Reading large quantity of data from a file

Scheduled Pinned Locked Moved C#
xmlperformancehelptutorial
4 Posts 2 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.
  • L Offline
    L Offline
    LCI
    wrote on last edited by
    #1

    I have to read a large quantity of bianry data from a file and then store this data in an XML tag. There is approximately 8 MB of data. This can be slow just to read the 8MB into memory using StreamReader. I tried reading sayy 500k at a time. But i still have the issue of storing 8MB into memory. If i would have just read 500k and then write 500k, i would be ok. But i am using XMLTextWriter that does not allow me to write tag data piece by piece. I have to have all the data and then write it to tag. Any suggestions on how to handle this effectively will be appreciated. Thanks, cw

    S 1 Reply Last reply
    0
    • L LCI

      I have to read a large quantity of bianry data from a file and then store this data in an XML tag. There is approximately 8 MB of data. This can be slow just to read the 8MB into memory using StreamReader. I tried reading sayy 500k at a time. But i still have the issue of storing 8MB into memory. If i would have just read 500k and then write 500k, i would be ok. But i am using XMLTextWriter that does not allow me to write tag data piece by piece. I have to have all the data and then write it to tag. Any suggestions on how to handle this effectively will be appreciated. Thanks, cw

      S Offline
      S Offline
      Spacix One
      wrote on last edited by
      #2

      if you are just saving binary to XML you'll double the size of your data. If you encode it to base64 it'll only be about 4/3 the orginal size, but with conversion overhead. Why do you need 8MB of binary data in XML anyway? To me it sounds like a design flaw not a memory issue.


      -Spacix All your skynet questions[^] belong to solved


      I dislike the black-and-white voting system on questions/answers. X|


      L 1 Reply Last reply
      0
      • S Spacix One

        if you are just saving binary to XML you'll double the size of your data. If you encode it to base64 it'll only be about 4/3 the orginal size, but with conversion overhead. Why do you need 8MB of binary data in XML anyway? To me it sounds like a design flaw not a memory issue.


        -Spacix All your skynet questions[^] belong to solved


        I dislike the black-and-white voting system on questions/answers. X|


        L Offline
        L Offline
        LCI
        wrote on last edited by
        #3

        I actually do encode to base64. It does not even get that far as it is stuck reading all the data from the file. The reason i need to do it this way is because another application creates this data(video) and dumps it to a folder. My application has to read it in, and put in an XML tag along with other data pertaining to it. Any ideas to make this process better from a bandwidth perspective?

        S 1 Reply Last reply
        0
        • L LCI

          I actually do encode to base64. It does not even get that far as it is stuck reading all the data from the file. The reason i need to do it this way is because another application creates this data(video) and dumps it to a folder. My application has to read it in, and put in an XML tag along with other data pertaining to it. Any ideas to make this process better from a bandwidth perspective?

          S Offline
          S Offline
          Spacix One
          wrote on last edited by
          #4

          Use two files the raw data file the XML info file Then you can use something like CabLib (http://www.codeproject.com/KB/files/CABCompressExtract.aspx)[^] to extract/compress the two files together.


          -Spacix All your skynet questions[^] belong to solved


          I dislike the black-and-white voting system on questions/answers. X|


          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