This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Processing locale::_M_names decently fast


Hi.

Whereas for many applications isn't a performance bottleneck, the way we
are currently processing _M_names is awfully slow for the very common
case of "simple" locales (currently encoded as all equal _M_names (e.g.,
all "C", all "fr_FR")).

Luckily, probably we can fix rather easily that without changing the
3.4/3.5 ABI.

The basic idea is the following: whenever the locale has no name, we can
store a "*" in _M_names[0], nothing in the other positions. Whenever the
locale has a "simple" name we can store the name in _M_names[0] (f.i.,
"de_DE"), and, say, a "*" in _M_names[1], nothing in the other positions.

_M_check_same_name would become /very/ fast, likewise locale::name() and
so on...

At the root of the idea is the observation that I already tried to present
yesterday (not completely succesfully): if a locale has no name it can't
acquire one piecewise, one category at a time, producing something like

LC_CTYPE=*;LC_NUMERIC=de_DE;LC_TIME=*;...

in the process. Or not?

This is a **much** weaker requirement than allowing locale::combine(loc)
to produce a named locale if *this and loc have a name and Facet is a
standard facet (as discussed with Martin).

If nobody finds a fundamental flaw in my sketch, I'll try to implement
it soon.

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]