Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3218: string_algo algorithms are quite slow in some popular compiler/OS/hardware situations
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-26 22:30:43
#3218: string_algo algorithms are quite slow in some popular compiler/OS/hardware
situations
------------------------------------------------------+---------------------
Reporter: Yuri Goldfeld <yuri_goldfeld@â¦> | Owner: pavol_droba
Type: Bugs | Status: new
Milestone: To Be Determined | Component: string_algo
Version: Boost 1.37.0 | Severity: Problem
Keywords: performance string_algo strings |
------------------------------------------------------+---------------------
Comment(by anonymous):
Good guess, especially since it seems like in-place-modifying functions
like to_lower() are much slower than intuitively slower copying ones like
to_lower_copy(). Unfortunately, disabling SCL did not fix it. The 2nd
perf.cpp I attached prints whether _SECURE_SCL is enabled in Windows. I
disabled it in Project Properties like you said (_SECURE_SCL=0). I also
turned up every optimization setting to maximum, with the resulting
command line:
{{{/Ox /Ob2 /Oi /Ot /Oy /GL /I "C:\workspaces\client-1.4.7\akamai\boost"
/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_SECURE_SCL=0" /D "_UNICODE" /D
"UNICODE" /FD /EHsc /MD /Gy /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /WX
/nologo /c /Zi /TP /errorReport:prompt}}}
This was the output:
{{{
C:\projects\boost_perf\Release>boost_perf.exe
Windows build: _SECURE_SCL = 0
string("abcdefgh") == string("abcdefgh")| 612 msec.
equals(string("abcdefgh"), string("abcdefgh"))| 1046 msec.
Boost/hand ratio = 1.70915
StartsWith(string("abcdefghi"), "abcd")| 266 msec.
starts_with(string("abcdefghi"), "abcd")| 553 msec.
Boost/hand ratio = 2.07895
StartsWithI(string("abcdefghi"), "aBcD")| 337 msec.
istarts_with(string("abcdefghi"), "aBcD")| 3320 msec.
Boost/hand ratio = 9.85163
EqualsI("abcdefghi", "aBcDeFgHi")| 170 msec.
iequals("abcdefghi", "aBcDeFgHi")| 5248 msec.
Boost/hand ratio = 30.8706
ToUpperCopy(string("aBcDeFgHi"))| 590 msec.
to_upper_copy(string("aBcDeFgHi"))| 3445 msec.
Boost/hand ratio = 5.83898
ToLowerCopy(string("aBcDeFgHi"))| 591 msec.
to_lower_copy(string("aBcDeFgHi"))| 3385 msec.
Boost/hand ratio = 5.72758
ToLower(str)| 160 msec.
to_lower(str)| 2847 msec.
Boost/hand ratio = 17.7938
ToUpper(str)| 160 msec.
to_upper(str)| 2841 msec.
Boost/hand ratio = 17.7563
}}}
Note the first line, which prints the value of _SECURE_SCL. The docs you
gave were for VS 2005, but it's all the same for VS 2008:
http://msdn.microsoft.com/en-us/library/aa985965.aspx
If there's anything else to try, let me know.
Replying to [comment:2 pavol_droba]:
> Just curious, VC++2008 employs quite rigorous run-time checking, which
is sometimes enabled even in the Release mode. This checks significantly
reduce the performance. To get a serious reading I suggest to disable all
checks and compile in Relaase mode with maximum optimization possible. One
example is SCL to disable it use #define _SECURE_SCL=0 or add
_SECURE_SCL=0 into C++/Preprocessor in the project settings.
>
> Can you please re-run the tests using this settings?
>
> More info here:
> http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3218#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC