[Bug libstdc++/23956] Class __mt_alloc overexerts __policy_type::_S_get_pool
guillaume dot melquiond at ens-lyon dot fr
gcc-bugzilla@gcc.gnu.org
Tue Sep 20 05:07:00 GMT 2005
------- Additional Comments From guillaume dot melquiond at ens-lyon dot fr 2005-09-20 05:07 -------
Created an attachment (id=9779)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9779&action=view)
Remove gratuitous calls to _S_get_pool in __mt_alloc
Since I didn't find any reason for these calls, I removed them (see attached
patch) and ran a few tests. The following testcase has been compiled at -O3
-march=pentium3.
#include <list>
int main() {
for(int j = 0; j < 10000000; ++j) {
std::list<int> a, b, c;
std::list<double> d, e, f;
std::list<char> g, h, i;
}
}
Without the calls, the list creation is 70% faster: 2.2s instead of 3.7s on my
computer. When adding an element into each list at each iteration, there still
is a 15% speedup: 15.4s instead of 17.8s. So the cost of these calls to
_S_get_pool is not negligible. And the other STL containers are affected as
well, not just std::list.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23956
More information about the Gcc-bugs
mailing list