Click here to Skip to main content
15,921,052 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to search a large text file quicker Pin
dazinith7-Mar-03 10:23
dazinith7-Mar-03 10:23 
GeneralRe: How to search a large text file quicker Pin
Scott H. Settlemier7-Mar-03 11:21
Scott H. Settlemier7-Mar-03 11:21 
AnswerRe: How to search a large text file quicker Pin
Tim Smith7-Mar-03 10:25
Tim Smith7-Mar-03 10:25 
GeneralRe: How to search a large text file quicker Pin
dazinith7-Mar-03 11:00
dazinith7-Mar-03 11:00 
GeneralRe: How to search a large text file quicker Pin
Tim Smith7-Mar-03 11:44
Tim Smith7-Mar-03 11:44 
AnswerRe: How to search a large text file quicker Pin
Ted Ferenc8-Mar-03 2:02
Ted Ferenc8-Mar-03 2:02 
GeneralDShow-implementing CBaseControlWindow Pin
Jakub Misek7-Mar-03 9:36
Jakub Misek7-Mar-03 9:36 
QuestionCompliers and File IO buffer efficiency? Pin
phyzics7-Mar-03 9:12
phyzics7-Mar-03 9:12 
I was experimenting with file IO times and discovered some peculiar results that I do not understand and thought mabye sombody could explain it to me.

I was testing the hypothesis that in file IO processing it is better to use a bigger buffer than a smaller one (I was thinking that the fastest way to perform large file IO was to read a disk sector at a time). To test this I performed the following test.

Test:
Copy one file on one drive to another file on another drive. To perform the copy I used VisualC++ 6.0 on a box running Win2k. I wrote a simple console app that just used fread() and fwrite() to and from the files on the different drives.

Results:
The results I got were shocking to me. I ran the code in debug mode first and discovered that on my hardware and a 120Mb file copy I obtainted the following times (in seconds) for each read/write buffer size:

1 byte = 128(s)
2 bytes = 112(s)
4 bytes = 104(s)
8 bytes = 100(s)
16 bytes = 99(s)
...
512K bytes = 99(s)


So there appeared to be a threashold at around 8 bytes above which buffer size makes no difference.

When I re-ran the code in Release mode with the optimizer set to maximize speed the results were much different:

1 byte = 120(s)
2 bytes = 120(s)
...
512K bytes = 120(s)

The "plateau" region went away and the curve flattened out. However the large buffer read times went up! This makes no sense to me!

Does anybody out there know what is going on here? I would appreciate any enlightenment.

Thanks!


AnswerRe: Compliers and File IO buffer efficiency? Pin
Tim Smith7-Mar-03 9:22
Tim Smith7-Mar-03 9:22 
GeneralHelp With Threads...PLEASE! Pin
dantan987-Mar-03 7:57
dantan987-Mar-03 7:57 
GeneralRe: Help With Threads...PLEASE! Pin
dantan987-Mar-03 7:59
dantan987-Mar-03 7:59 
GeneralRe: Help With Threads...PLEASE! Pin
AlexO7-Mar-03 8:16
AlexO7-Mar-03 8:16 
GeneralRe: Help With Threads...PLEASE! Pin
dantan987-Mar-03 8:34
dantan987-Mar-03 8:34 
GeneralRe: Help With Threads...PLEASE! Pin
AlexO7-Mar-03 9:28
AlexO7-Mar-03 9:28 
GeneralRe: Help With Threads...PLEASE! Pin
Scott H. Settlemier7-Mar-03 9:59
Scott H. Settlemier7-Mar-03 9:59 
GeneralRe: Help With Threads...PLEASE! Pin
Neville Franks7-Mar-03 10:26
Neville Franks7-Mar-03 10:26 
GeneralRe: Help With Threads...PLEASE! Pin
Scott H. Settlemier7-Mar-03 11:27
Scott H. Settlemier7-Mar-03 11:27 
GeneralRe: Help With Threads...PLEASE! Pin
AlexO7-Mar-03 10:45
AlexO7-Mar-03 10:45 
GeneralOpen a Text File on SDI (Listview) Project Pin
Member 2693577-Mar-03 7:07
Member 2693577-Mar-03 7:07 
GeneralRe: Open a Text File on SDI (Listview) Project Pin
RobJones7-Mar-03 7:19
RobJones7-Mar-03 7:19 
GeneralRe: Open a Text File on SDI (Listview) Project Pin
7-Mar-03 9:55
suss7-Mar-03 9:55 
GeneralRe: Open a Text File on SDI (Listview) Project Pin
RobJones7-Mar-03 10:23
RobJones7-Mar-03 10:23 
Generalpreventing from copying Pin
_ra7-Mar-03 5:50
_ra7-Mar-03 5:50 
GeneralRe: preventing from copying Pin
AlexO7-Mar-03 6:07
AlexO7-Mar-03 6:07 
GeneralRe: preventing from copying Pin
Alvaro Mendez7-Mar-03 6:08
Alvaro Mendez7-Mar-03 6:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.