ctype optimization work
Jerry Quinn
jlquinn@optonline.net
Wed Dec 10 14:17:00 GMT 2003
Paolo Carlini writes:
> Jerry Quinn wrote:
>
> > I just looked closer at this. One problem is that you can't build the
> > table in the ctype<wchar_t> constructor. There's no way to delay the
> > table construction until a derived class constructor finishes
> > executing. If you construct the table too soon, that may break a
> > derived do_narrow function.
>
> I don't follow, honestly. My idea is really straightforward, identical
> to what currently *already* happens for moneypunt and numpunct and
> _M_initialize_moneypunct() and _M_initialize_numpunct(). Could you
> possibly explain your concerns in better detail?
OK, I was thinking that you would try to eliminate the call to the
virtual ctype<wchar_t>::do_narrow(). If the speedup code is confined
to the do_narrow function, then what I was saying doesn't apply.
My thinking has been colored by looking at ctype<char>.
ctype<char>::do_narrow just returns what it is given, so nothing can
really be improved there. The only improvement is to avoid calling
do_narrow when possible.
With ctype<wchar_t> you're getting most of the speedup by avoiding the
call to wctob. This seems to be a big win.
Jerry
More information about the Libstdc++
mailing list