[Patch] Use std::search in string::find
Dhruv Matani
dhruvbird@gmx.net
Sun Jun 13 03:41:00 GMT 2004
*On Sat, 2004-06-12 at 15:31, Dhruv Matani wrote:
> Hi,
> You might also want to patch rfind, while you are at it. Included is a
> function rr_find, that attempts to emulate rfind, and also the timings
> for that function relative to string::rfind.
Here is a version that takes a const char*, size_type, and size_type, it
can be adopted easily if you feel it's fine.
>
>
>
>
> On Sat, 2004-06-12 at 01:46, Paolo Carlini wrote:
> > Hi,
> >
> > the below is what I have implemented and tested on x86 and x86-64.
> >
> > Interestingly for the new performance testcase the stripped code
> > size does *not* change. In mainline the total time changes as
> > follows on P4-2400 (always -O2):
> >
> > current mainline x86
> > --------------------
> > 22.370u 0.000s 0:22.46 99.5% 0+0k 0+0io 166pf+0w
> >
> > patched mainline x86
> > --------------------
> > 9.090u 0.000s 0:09.13 99.5% 0+0k 0+0io 168pf+0w
> >
> > And as follows on x86-64-2GHz:
> >
> > current mainline x86-64
> > -----------------------
> > 5.216u 0.000s 0:05.21 100.0% 0+0k 0+0io 0pf+0w
> >
> > patched mainline x86-64
> > -----------------------
> > 4.743u 0.000s 0:04.74 100.0% 0+0k 0+0io 0pf+0w
> >
> > In general, in these days often happens that on x86 current 3.4
> > gives better results than mainline. Indeed, this happens here
> > too for unpatched 3.4:
> >
> > current 3.4 x86
> > ---------------
> > 14.920u 0.010s 0:15.03 99.3% 0+0k 0+0io 162pf+0w
> >
> > patched 3.4 x86
> > ---------------
> > 9.450u 0.010s 0:09.51 99.4% 0+0k 0+0io 164pf+0w
> >
> > All in all, the numbers speak in favor of this approach, and,
> > in case we really want to change the algorithm, we can just
> > improve the one provided generically in std::search.
> >
> > I'll wait 'til tomorrow in case of comments.
> >
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: str_rfind.cpp
Type: text/x-c++
Size: 2120 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040613/0c6c6557/attachment.bin>
More information about the Libstdc++
mailing list