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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ReadFile operation

ReadFile operation

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 5 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.
  • M Offline
    M Offline
    MKC002
    wrote on last edited by
    #1

    I found ReadFile operation is slow. Is there ay way to make it fast? Or is there any assemble code available to read from file/disk

    enhzflepE L D R 4 Replies Last reply
    0
    • M MKC002

      I found ReadFile operation is slow. Is there ay way to make it fast? Or is there any assemble code available to read from file/disk

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #2

      Often times, when disk-io needs to be sped-up there are gains to be made in the way that the data is accessed -but not so much (if any gain) available in the function used to get that data. For example - if you have (say)a million pieces of data stored in a file, it's a better(faster) option to use ReadFile just once and read in the 1,000,000 pieces of data than it is to call the function 1,000,000 times to read 1 piece of data. Provided you're running in an OS with protected memory (i.e not DOS), no - not practically. You could attempt to write some low level code, but I'd suspect that the folk that wrote that part of windows would be more capable of speed than you. ;P Are you able to elaborate on the conditions in which you're using ReadFile, and the reasons you've come to the conclusion it's slow? It's very likely that algorithmic improvements can be made. :)

      1 Reply Last reply
      0
      • M MKC002

        I found ReadFile operation is slow. Is there ay way to make it fast? Or is there any assemble code available to read from file/disk

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        How do you measure "slow"? At the very best a ReadFile() operation will operate at the transfer speed of the disk and its interface. At the very worst there are lots of factors that may affect it.

        The best things in life are not things.

        1 Reply Last reply
        0
        • M MKC002

          I found ReadFile operation is slow. Is there ay way to make it fast? Or is there any assemble code available to read from file/disk

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Disk I/O in itself is slow, regardless of the API used. What exactly are you needing to do?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather

          M 1 Reply Last reply
          0
          • D David Crow

            Disk I/O in itself is slow, regardless of the API used. What exactly are you needing to do?

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather

            M Offline
            M Offline
            MKC002
            wrote on last edited by
            #5

            I read data from a drive at different locations. I can not read large data because of some memory issue. Why it's slow because i check one software which reads it fast.

            1 Reply Last reply
            0
            • M MKC002

              I found ReadFile operation is slow. Is there ay way to make it fast? Or is there any assemble code available to read from file/disk

              R Offline
              R Offline
              Rolf Kristensen
              wrote on last edited by
              #6

              Usually when reading from a file, then one reads in small chunks like one byte at a time. If using a wrapper around ReadFile like fstream, then it will perform readahead caching by reading large chunks from the file into memory. When reading small chunks from fstream, then it will actually read directly from the internal cache inside fstream.

              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