[Patch] Fix libstdc++/13341 (speed-up <wchar_t>::do_narrow/widen)

Paolo Carlini pcarlini@suse.de
Thu Dec 11 16:24:00 GMT 2003


Hi,

this is my modest proposal, limited to the wchar_t versions of
do_widen and do_narrow. For the common case it results in a
pretty good speed up:

 for (long i = 0; i < 100000000; ++i)
   ct.widen(i % 128);
   // ct.narrow(i % 128, '*');

On my P4-2400, -O2:

3.4
---
widen:   7.650u 0.000s 0:07.66 99.8%     0+0k 0+0io 167pf+0w
narrow: 11.650u 0.000s 0:11.69 99.6%     0+0k 0+0io 168pf+0w

3.4 + patch
-----------
widen:   1.270u 0.010s 0:01.28 100.0%    0+0k 0+0io 169pf+0w
narrow:  1.270u 0.000s 0:01.27 100.0%    0+0k 0+0io 169pf+0w


Tested x86-linux (gnu/generic).

I will wait some 24 hours for comments...

Paolo.

///////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_13341
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031211/ecbfe5d5/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_13341
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031211/ecbfe5d5/attachment-0001.ksh>


More information about the Libstdc++ mailing list