DateTimers,

While profiling Sqitch, I found that the biggest suck on its time (now that I 
have removed Moose and Mouse in favor of Moo) is DateTime. The reason? It loads 
all of the locales in its BEGIN block. Run this to see for yourself:

    perl -d:NYTProf -e 'use DateTime;' && nytprofhtml --open

Here's the topline:
Top 15 Subroutines
Calls   P       F       Exclusive
Time    Inclusive
Time    Subroutine
466     1       1       15.6ms  24.4ms           DateTime::Locale::_register
1       1       1       11.2ms  119ms                        main::BEGIN@1
468     2       2       8.65ms  8.65ms       Params::Validate::XS::validate 
(xsub)
1       1       1       8.29ms  8.50ms           DateTime::Locale::BEGIN@11
9       9       6       5.23ms  6.44ms                       base::import 
(recurses: max depth 2, inclusive time 1.79ms)
1       1       1       3.65ms  7.98ms                   DateTime::BEGIN@16
1       1       1       3.53ms  4.54ms  DateTime::TimeZone::Local::BEGIN@8
1       1       1       3.22ms  21.6ms                   DateTime::BEGIN@13
1       1       1       2.99ms  3.08ms         DateTime::TimeZone::BEGIN@8
1       1       1       2.97ms  3.19ms                   DateTime::BEGIN@9
1       1       1       2.91ms  4.26ms           DateTime::Locale::BEGIN@10
1       1       1       2.74ms  6.58ms           DateTime::Locale::add_aliases
24      24      18      2.73ms  2.97ms                   Exporter::import
1       1       1       2.53ms  2.87ms      Try::Tiny::ScopeGuard::BEGIN@144
1       1       1       2.38ms  3.00ms              Data::OptList::BEGIN@10

Does DateTime *really* need to always load all 466 locales on startup? Couldn't 
it load them on demand?

Thanks,

David

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to