Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
SUSE:SLE-12:Update
gcc33
istream-perf.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File istream-perf.diff of Package gcc33
the below is a (safe) backport from mainline and 3_4-branch: improves 2-3x the performance of operator>>(basic_istream<>&, basic_string<>&), a rather common facility. Tested x86-linux, make check/check-abi. Paolo. /////////////// [ Part 2: "Attached Text" ] 2004-06-22 Paolo Carlini <pcarlini@suse.de> * include/bits/istream.tcc (operator>>(basic_istream<>&, basic_string<>&)): Use a temporary buffer, thus avoiding reallocation for common case. [ Part 3: "Attached Text" ] diff -urN libstdc++-v3-orig/include/bits/istream.tcc libstdc++-v3/include/bits/istream.tcc --- libstdc++-v3-orig/include/bits/istream.tcc 2004-05-02 18:10:34.000000000 +0200 +++ libstdc++-v3/include/bits/istream.tcc 2004-06-22 14:22:07.000000000 +0200 @@ -1038,7 +1038,10 @@ { try { + // Avoid reallocation for common case. __str.erase(); + _CharT __buf[128]; + __size_type __len = 0; streamsize __w = __in.width(); __size_type __n; __n = __w > 0 ? static_cast<__size_type>(__w) : __str.max_size(); @@ -1052,10 +1055,17 @@ && !_Traits::eq_int_type(__c, __eof) && !__ct.is(ctype_base::space, _Traits::to_char_type(__c))) { - __str += _Traits::to_char_type(__c); + if (__len == sizeof(__buf) / sizeof(_CharT)) + { + __str.append(__buf, sizeof(__buf) / sizeof(_CharT)); + __len = 0; + } + __buf[__len++] = _Traits::to_char_type(__c); ++__extracted; __c = __sb->snextc(); } + __str.append(__buf, __len); + if (_Traits::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; __in.width(0);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor