Re: Must DateTime load all Locales?

[email protected] ("David E. Wheeler") Sat, 9 Aug 2014 15:54:04 -0700
Newsgroups perl.datetime
Message-ID <[email protected]>
On Aug 7, 2014, at 11:23 AM, Dave Rolsky <[email protected]> wrote:

>> I think the overhead comes in the DateTime::Locale::_register() function, which is called once for each locale returned by DateTime::Locale::Catalog. I would not think any locales would be loaded until they were needed.
> 
> And you would be correct. The individual locale classes are not loaded until you call DateTime::Locale->load

I see. So _register does not load them, but is still the startup bottleneck. What on earth is it doing?

> What could speed things up would be to pre-generate the data structures that are built by calling ->register on everything in the Catalog module.

It builds up in-memory data structures for all of the locales? Wow. Yeah, seems like those could be encapsulated in the locales themselves or something, no?

> That all said, DT::Locale is woefully crufty and out of date. I haven't kept up to date with the CLDR data for years because the approach that DT::Locale uses to generate individual locales makes it incredibly hard to deal with data format changes in CLDR.

Ah. So some locale results will probably be wrong now, eh?

> Nick Patch had mentioned that he was interested in working on proper CLDR support for Perl (which is more than just DateTime info), and I was hoping he'd take all this over ;)

Is CLDR::Number part of that, perhaps?

  http://search.cpan.org/dist/CLDR-Number/

I have updated Sqitch to defer loading DateTime at all until it is needed. Alas, it is often needed. Sure would be nice to cut down on this startup time in general.

Best,

David
signature.asc (application/pgp-signature, 842 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJT5qaMAAoJEJLfYnT4yIHxCXgP/2nqu9WFhtT6LPtwJXci8SOC
Y/hUtxGlr47G+yDTznhj9SbWJGeex82dMMzHgUp6GgZq/18NjYBdOMfd0i8K3Cu6
e82j+xkVZuW+V/rm6Zz6dwpmvfrYOFvxBwEz4IPRZ6IO7XPaq6mxEbYkQRBXxNJ5
fYUqp8Nu4JQZ9wR0tIk9/Oq/AeYm0hhK5s1JQ7limxUKUWFyzdcLHyFwqwpOxkXw
sXJq4Zfk98623KAUyS+z2txVOsU6NE6yHhtCY9KDRQH4kgK/d4o3j7XlbndNSu7/
DX8fVpHWD4ZKch9jngxVdk0gqLWX7wNloZYu/XF9rvsUeeNBnOBoWlbEWPQstqzu
Cz1AA4ayHRkXnVM+xjx+HG+kfeUTZTLt9P27tAsFbI5amKsK9OLWr/iwFkyoYFMr
uoZdmA1ZcnnQ7uNOAErUrT5PWLxufgbu1S9CGH9JYhfjWv7/JocEhFYXFF58SF0C
uF7juRKusE4MyH9YJiJvgOins9h67IJvxISk5MUmk/OPnaLvVsvi/yZngq5sIFbd
5O6paoDRJbc7uKVc64kOWhNmiSUYyS07qtYm3HNuKDuVP6mSa4mU5O3X+mf8pMcw
Rq3LKzRiMS05+B39QkKki/ycDlAzI+rtiZTHqsLX7CNxjVQY4S05ESXQ6HrBqKp3
TsXGa5V6pfaqjSPyKnCe
=LGvT
-----END PGP SIGNATURE-----