Strange optimization results
Дмитрий Оксенчук
oksenchuk89@gmail.com
Sun Apr 10 17:18:00 GMT 2011
I have tested performance of std::string compare methods and get
strange results. With -O2 optimization std::string::compare 30 times
faster then operator==. With -Os optimization operator== 5 times
faster then std::string::compare. Is this bug or feature?
Full table (time for 10000000 comparisons in seconds):
-O0 -O1 -O2 -O3 -Os
compare 1.069 1.057 0.029 0.025 1.072
operator== 0.461 0.990 0.980 1.022 0.201
g++ (Debian 4.3.4-6) 4.3.4. Test code attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 418 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20110410/fe1e5f78/attachment.bin>
More information about the Gcc-help
mailing list