Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
locale.c: Skip locale utf8ness calculation if feasible
I originally wrote this to save time processing the strings returned by localeconv(). If we know that the locale isn't UTF-8, then we don't have to calculate this for each string returned. Calculate once, not many times. But I hadn't realized that likely only one string is ever going to be non-ASCII: the currency symbol. (The decimal and thousands separators could also be, but of the >500 locales on my Linux box, only ps_AF has them so. That is Pashtun language in Afghanistan; not a frequently occurring locale.) So it comes down to either case is effectively "calculate once". And it is generally more expensive to calculate the UTF8ness of a locale than a particular string in it, especially when those strings are going to be ASCII, as in this case. This commit changes to not calculate the locale's UTF8ness.
- Loading branch information