I did, with VC 7.1:Quote:
Originally Posted by Axter
Time duration is as follow:
CString = 2579
std::string = 2484
Press any key to continue . . .
Printable View
I did, with VC 7.1:Quote:
Originally Posted by Axter
Time duration is as follow:
CString = 2579
std::string = 2484
Press any key to continue . . .
Actually, I did run your code. The code that I compiled and posted the results of earlier was the test1.cpp file that Paul attached to message #28. It did have the release-mode check in place.Quote:
Originally Posted by Axter
Nope. It was definitely release version.Quote:
Originally Posted by Axter
No third party libraries either.
std::string is always faster.
Output from the new codeQuote:
Originally Posted by Axter
Time duration is as follow:
CString = 4036
std::string = 4627
Press any key to continue . . .
The original code shows std:string to be faster.
The new code shows CString to be faster.
Both sets of code compiled as Release versions.
:confused:
If you disable exception handling in the project settings...
Time duration is as follow:
CString = 4246 <<<< Increase
std::string = 4376 <<<< Decrease
Press any key to continue . . .
Looks like a very recent thread (only 7 years old, nothing compared to the cosmos)
Mckenzie and Axter, you guys were using systems with different system configuration. That is probably the explanation.
I had tested it in several different systems, and they all gave similar results.
However, this thread is out dated, and more than likely does not hold true for the current std::string implementation that comes with current version of VC++.
If you are still curious (I know I would be), here are the results from VS2010 (running on Win7-64, if that matters):
CString here is from ATL, not MFC.Quote:
CString = 1623
std::string = 624
I haven’t looked at the code close enough yet, but just wanted to say that if you know implementation details of each of these classes, you could come up with the test that favors any one of them. IIRC, both Intel and AMD used that technique in the past.