buffer - c# reading text file with contention from other instances -


i have app reads data text file using:

                crd.reader = new streamreader(fn,encoding.utf8,true,1024);                 crd.readline(); 

but run 16 instances of app in parallel on 24 core machine. when total time taken greater time takes single instance running on it's own (even though running in parallel). assume because of contention disk?

i saw suggestion using bufferedstream, don't understand how differs code above. surely specifying buffer size have - using "buffered" stream already?

for code, have tried various different size buffer - not appear make difference.

edit 1 

if explain how bufferedstream differs doing - helpful

edit 2 

if set large buffer with

crd.reader = new streamreader(fn,encoding.utf8,true,65536);                 crd.readline(); 

can force whole buffer filled on first readline? i.e. if buffer > filesize whole file could/should read memory. seems me operating system works allowing buffer, not using it.

if file sizes, according comment, 2mb, fast processing solution

  • first read memory, in 1 shot, using example file.readalltext method

  • after process content, present in memory, much faster, reading line line disk.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -