Click here to Skip to main content
16,004,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Dialogbox Issue ? Pin
prasad_som8-Feb-07 1:08
prasad_som8-Feb-07 1:08 
QuestionCString - high CPU usage Pin
micutzu8-Feb-07 0:52
micutzu8-Feb-07 0:52 
AnswerRe: CString - high CPU usage Pin
James R. Twine8-Feb-07 1:11
James R. Twine8-Feb-07 1:11 
AnswerRe: CString - high CPU usage Pin
kakan8-Feb-07 2:02
professionalkakan8-Feb-07 2:02 
AnswerRe: CString - high CPU usage Pin
David Crow8-Feb-07 3:33
David Crow8-Feb-07 3:33 
GeneralRe: CString - high CPU usage Pin
Gary R. Wheeler8-Feb-07 4:00
Gary R. Wheeler8-Feb-07 4:00 
GeneralRe: CString - high CPU usage Pin
David Crow8-Feb-07 4:08
David Crow8-Feb-07 4:08 
GeneralRe: CString - high CPU usage Pin
James R. Twine8-Feb-07 4:30
James R. Twine8-Feb-07 4:30 
Gary R. Wheeler wrote:
Is string actually faster? Do you know of any benchmark results? I've got a couple classes in an application that use CString heavily, and wonder if string would improve their performance.

   The memory allocation schemes are different between the two.  I believe (but I could be wrong) that the std::string object allocates like std::vector does - that is, it doubles each time.  8 characters, then 16 characters, then 32 characters, etc.

   CString on the other hand, basically only allocates what it needs.  In MFC 6.0 release mode, CString will use the CPlex* allocators which allocate memory in fixed sized chunks, so that if you keep appending smaller strings or single characters to a CString it may not have to reallocate each time.

   std::string can have its reference counting turned off (or it may be by default in some implementations), which may increase its performance a bit.

   I guess it would depend on the usage of the string object.  If you are simply using them as replacements for a manually managed char buffer, and are not doing anything really specific to a string object with it, you may not notice much difference.  If you build strings through constant append operations, you may notice a difference.

   If using a multithreaded VC++ 6.0 app, you can customize the allocator used for std::string much easier than CString, which will allow you to help mitigate heap contention between threads.  (Which can be a big hit if CString abuse is high.)

   :P  IMHO, the best way you can increase CString performance is to avoid it entirely!  :P

   Peace!

-=- James
Please rate this message - let me know if I helped or not!<HR>If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles

GeneralRe: CString - high CPU usage Pin
Sceptic Mole8-Feb-07 9:31
Sceptic Mole8-Feb-07 9:31 
GeneralRe: CString - high CPU usage Pin
James R. Twine8-Feb-07 15:27
James R. Twine8-Feb-07 15:27 
QuestionMultiByteToWideChar problem? Pin
Cpt Rick8-Feb-07 0:16
Cpt Rick8-Feb-07 0:16 
AnswerRe: MultiByteToWideChar problem? Pin
Don Box8-Feb-07 0:38
Don Box8-Feb-07 0:38 
GeneralRe: MultiByteToWideChar problem? Pin
Mark Salsbery8-Feb-07 5:41
Mark Salsbery8-Feb-07 5:41 
AnswerRe: MultiByteToWideChar problem? Pin
prasad_som8-Feb-07 0:51
prasad_som8-Feb-07 0:51 
AnswerRe: MultiByteToWideChar problem? Pin
Cpt Rick8-Feb-07 3:22
Cpt Rick8-Feb-07 3:22 
GeneralRe: MultiByteToWideChar problem? Pin
James R. Twine8-Feb-07 4:36
James R. Twine8-Feb-07 4:36 
Questiongraphics library functions(OpenGL) Pin
sheetal_067-Feb-07 23:35
sheetal_067-Feb-07 23:35 
AnswerRe: graphics library functions(OpenGL) Pin
Hamid_RT7-Feb-07 23:45
Hamid_RT7-Feb-07 23:45 
Question64bit builds Pin
Waldermort7-Feb-07 23:28
Waldermort7-Feb-07 23:28 
AnswerRe: 64bit builds Pin
Gary R. Wheeler8-Feb-07 4:05
Gary R. Wheeler8-Feb-07 4:05 
AnswerRe: 64bit builds Pin
cmk8-Feb-07 19:10
cmk8-Feb-07 19:10 
QuestionMMC program: how to close property sheet Pin
Finix7-Feb-07 23:21
Finix7-Feb-07 23:21 
QuestionRe: MMC program: how to close property sheet Pin
Mark Salsbery8-Feb-07 5:56
Mark Salsbery8-Feb-07 5:56 
AnswerRe: MMC program: how to close property sheet Pin
Finix8-Feb-07 15:21
Finix8-Feb-07 15:21 
GeneralRe: MMC program: how to close property sheet Pin
Mark Salsbery8-Feb-07 15:26
Mark Salsbery8-Feb-07 15:26 

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.