Copy files - buffered streams vs File.Copy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LiorO
    New Member
    • Apr 2008
    • 1

    Copy files - buffered streams vs File.Copy

    Hi,
    I need to implement a high performance file copying.
    The File.Copy method in .NET is fast enough however I need to control the speed since it should be performed in the background without affecting the process too much.
    I've implemented a buffered (FileStream) copy using a queue for the bufferes.
    The performance is about 60% slower than the File.Copy.

    I've heard something about unbuffered stream, however I couldn't find anything usefull in the net.
    Can anyone spread his wisdom one this method?
    Any idea how can I improve the buffered copy mechanism?

    Thanks a lot.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by LiorO
    Hi,
    I need to implement a high performance file copying.
    The File.Copy method in .NET is fast enough however I need to control the speed since it should be performed in the background without affecting the process too much.
    I've implemented a buffered (FileStream) copy using a queue for the bufferes.
    The performance is about 60% slower than the File.Copy.

    I've heard something about unbuffered stream, however I couldn't find anything usefull in the net.
    Can anyone spread his wisdom one this method?
    Any idea how can I improve the buffered copy mechanism?

    Thanks a lot.
    I haven't got your requirements correctly yet, sorry I always seem to miss the obvious.
    Do you want your "buffered copy mechanism" to go faster or slower than the File.Copy method?
    Also by "improving" it, do you mean you want it to be faster than it is now?
    If that's the case, then you'll need to post how you've done it so that people can see where to improve.

    Comment

    Working...