svn commit: r227753 - in head: contrib/gdtoa include lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/libc/string

David Schultz das at FreeBSD.ORG
Wed Jan 18 19:07:15 UTC 2012


On Sun, Nov 20, 2011, David Chisnall wrote:
> Author: theraven
> Date: Sun Nov 20 14:45:42 2011
> New Revision: 227753
> URL: http://svn.freebsd.org/changeset/base/227753
> 
> Log:
>   Implement xlocale APIs from Darwin, mainly for use by libc++.  This adds a
>   load of _l suffixed versions of various standard library functions that use
>   the global locale, making them take an explicit locale parameter.  Also
>   adds support for per-thread locales.  This work was funded by the FreeBSD
>   Foundation.
>   
>   Please test any code you have that uses the C standard locale functions!
>   
>   Reviewed by:    das (gdtoa changes)
>   Approved by:    dim (mentor)

This patch appears to cause a large performance regression.  For
example, I measured a 78% slowdown for strtol("    42", ...).
Furthermore, the resulting static binary for a trivial program
goes from 7k to 303k, due to pulling in malloc, stdio, and all the
pthread stubs.  Presumably the capabilities of the non-xlocale
entry points aren't appreciably changed, so there ought to be a
way to avoid the overhead for them.  Do you have any thoughts on this?

Some more minor issues...

It's also customary to document public APIs so that, for
instance, `man printf_l' pulls up a page with the prototype,
required #includes, and behavior.  Aliasing manpages with
MLINKS as appropriate is fine; for instance, Darwin's manpages
on these functions look like a good example to follow.

Finally, I'm not usually one to be picky about style, but could
you make a pass to clean things up a little bit to match the
surrounding code, wrap multiline comments to 80 columns, etc?
You've also added new copyright notices for one-line changes
(e.g., stdio/vdprintf.c, gdtoa/machdep_ldis?.c) and multiple
copyright notices in the same file (locale/collate.c), which
could be cleaned up concurrently.


More information about the svn-src-all mailing list