Click here to Skip to main content
14,241,210 members

ATL / WTL / STL

 
QuestionRe: Time of reading text file Pin
Richard MacCutchan8-Nov-14 21:33
protectorRichard MacCutchan8-Nov-14 21:33 
AnswerRe: Time of reading text file Pin
econy11-Nov-14 2:06
memberecony11-Nov-14 2:06 
GeneralRe: Time of reading text file Pin
Richard MacCutchan11-Nov-14 5:42
protectorRichard MacCutchan11-Nov-14 5:42 
GeneralRe: Time of reading text file Pin
econy11-Nov-14 6:56
memberecony11-Nov-14 6:56 
GeneralRe: Time of reading text file Pin
Richard MacCutchan11-Nov-14 7:05
protectorRichard MacCutchan11-Nov-14 7:05 
GeneralRe: Time of reading text file Pin
econy11-Nov-14 7:17
memberecony11-Nov-14 7:17 
GeneralRe: Time of reading text file Pin
Richard MacCutchan11-Nov-14 7:25
protectorRichard MacCutchan11-Nov-14 7:25 
AnswerRe: Time of reading text file Pin
Aescleal12-Nov-14 6:01
memberAescleal12-Nov-14 6:01 
The first thing you've got to do is work out whether it's I/O bound or whether it's the data processing that's slowing things down. You might find that CFile isn't particularly well tuned for reading from flash and not buffering enough. If it turns out that it's the I/O that's causing the problem find the lowest level function you can call and see what the raw I/O speed of your device is for a range of buffer sizes and then implement something that hits the sweet spot in terms of buffer size. It's a shame you're using MFC classes and not standard library ones as it's a lot easier to replace the underlying buffering and I/O mechanism, but such is life!

Another thing might be to try reading more data in your while loop (say 512 characters at a time) and manually parcelling out the data rather than letting CFile::Read do it.

If it turns out that the I/O is fast enough then have a look at what you're doing with the data. If you've got a lot of string handling you might find loads of temporaries flying about (especially if you're using VC++ 2008 and earlier) and there's loads of hidden memory manipulation that's slowing things down. In that case look at reducing the number of temporaries you need by reusing objects and expoiting things like NRVO.

Anyway, the main thing though is to find out where the bottle neck is then do something about it.
QuestionOptimized Solution for prime numbers.. Pin
Raunak Singh Chauhan6-Nov-14 6:20
memberRaunak Singh Chauhan6-Nov-14 6:20 
AnswerRe: Optimized Solution for prime numbers.. Pin
Nicolas Dorier6-Nov-14 6:45
professionalNicolas Dorier6-Nov-14 6:45 
GeneralRe: Optimized Solution for prime numbers.. Pin
Raunak Singh Chauhan6-Nov-14 6:49
memberRaunak Singh Chauhan6-Nov-14 6:49 
GeneralRe: Optimized Solution for prime numbers.. Pin
Nicolas Dorier6-Nov-14 6:56
professionalNicolas Dorier6-Nov-14 6:56 
AnswerRe: Optimized Solution for prime numbers.. Pin
Bernhard Hiller6-Nov-14 22:06
memberBernhard Hiller6-Nov-14 22:06 
Questionget IP address from Net Address Control (Resolved) Pin
bkelly1310-Oct-14 16:06
memberbkelly1310-Oct-14 16:06 
AnswerRe: get IP address from Net Address Control Pin
Richard MacCutchan10-Oct-14 21:18
protectorRichard MacCutchan10-Oct-14 21:18 
GeneralRe: get IP address from Net Address Control Pin
bkelly1311-Oct-14 9:11
memberbkelly1311-Oct-14 9:11 
GeneralRe: get IP address from Net Address Control Pin
Richard MacCutchan13-Oct-14 5:10
protectorRichard MacCutchan13-Oct-14 5:10 
GeneralRe: get IP address from Net Address Control Pin
bkelly1318-Oct-14 10:44
memberbkelly1318-Oct-14 10:44 
GeneralRe: get IP address from Net Address Control Pin
Richard MacCutchan18-Oct-14 21:13
protectorRichard MacCutchan18-Oct-14 21:13 
GeneralRe: get IP address from Net Address Control Pin
bkelly1319-Oct-14 8:42
memberbkelly1319-Oct-14 8:42 
Generalserial port access and communication using c Pin
Member 111402618-Oct-14 22:51
memberMember 111402618-Oct-14 22:51 
GeneralRe: serial port access and communication using c Pin
pasztorpisti8-Oct-14 23:18
professionalpasztorpisti8-Oct-14 23:18 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 0:58
professionalOrjan Westin9-Oct-14 0:58 
GeneralRe: serial port access and communication using c Pin
pasztorpisti9-Oct-14 1:08
professionalpasztorpisti9-Oct-14 1:08 
GeneralRe: serial port access and communication using c Pin
Orjan Westin9-Oct-14 4:50
professionalOrjan Westin9-Oct-14 4:50 

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.