← Index
NYTProf Performance Profile   « line view »
For -e
  Run on Thu Jun 30 16:16:00 2016
Reported on Thu Jun 30 16:16:08 2016

Filename/home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/DateTime/Format/Alami/EN.pm
StatementsExecuted 10017 statements in 75.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.98ms4.05msDateTime::Format::Alami::EN::::BEGIN@8DateTime::Format::Alami::EN::BEGIN@8
111872µs971µsDateTime::Format::Alami::EN::::BEGIN@7DateTime::Format::Alami::EN::BEGIN@7
111788µs2.16msDateTime::Format::Alami::EN::::BEGIN@14DateTime::Format::Alami::EN::BEGIN@14
111533µs5.94msDateTime::Format::Alami::EN::::BEGIN@91DateTime::Format::Alami::EN::BEGIN@91
11139µs39µsDateTime::Format::Alami::EN::::BEGIN@6DateTime::Format::Alami::EN::BEGIN@6
22121µs21µsDateTime::Format::Alami::EN::::CORE:qrDateTime::Format::Alami::EN::CORE:qr (opcode)
11110µs25.4msDateTime::Format::Alami::EN::::BEGIN@92DateTime::Format::Alami::EN::BEGIN@92
0000s0sDateTime::Format::Alami::EN::::__ANON__[:94]DateTime::Format::Alami::EN::__ANON__[:94]
0000s0sDateTime::Format::Alami::EN::::__ANON__[:95]DateTime::Format::Alami::EN::__ANON__[:95]
0000s0sDateTime::Format::Alami::EN::::_parse_numDateTime::Format::Alami::EN::_parse_num
0000s0sDateTime::Format::Alami::EN::::o_ampmDateTime::Format::Alami::EN::o_ampm
0000s0sDateTime::Format::Alami::EN::::o_cardinal_suffixDateTime::Format::Alami::EN::o_cardinal_suffix
0000s0sDateTime::Format::Alami::EN::::o_dateDateTime::Format::Alami::EN::o_date
0000s0sDateTime::Format::Alami::EN::::o_numDateTime::Format::Alami::EN::o_num
0000s0sDateTime::Format::Alami::EN::::p_date_timeDateTime::Format::Alami::EN::p_date_time
0000s0sDateTime::Format::Alami::EN::::p_dateymdDateTime::Format::Alami::EN::p_dateymd
0000s0sDateTime::Format::Alami::EN::::p_dur_agoDateTime::Format::Alami::EN::p_dur_ago
0000s0sDateTime::Format::Alami::EN::::p_dur_laterDateTime::Format::Alami::EN::p_dur_later
0000s0sDateTime::Format::Alami::EN::::p_nowDateTime::Format::Alami::EN::p_now
0000s0sDateTime::Format::Alami::EN::::p_timeDateTime::Format::Alami::EN::p_time
0000s0sDateTime::Format::Alami::EN::::p_todayDateTime::Format::Alami::EN::p_today
0000s0sDateTime::Format::Alami::EN::::p_tomorrowDateTime::Format::Alami::EN::p_tomorrow
0000s0sDateTime::Format::Alami::EN::::p_which_dowDateTime::Format::Alami::EN::p_which_dow
0000s0sDateTime::Format::Alami::EN::::p_yesterdayDateTime::Format::Alami::EN::p_yesterday
0000s0sDateTime::Format::Alami::EN::::w_aprDateTime::Format::Alami::EN::w_apr
0000s0sDateTime::Format::Alami::EN::::w_augDateTime::Format::Alami::EN::w_aug
0000s0sDateTime::Format::Alami::EN::::w_dayDateTime::Format::Alami::EN::w_day
0000s0sDateTime::Format::Alami::EN::::w_decDateTime::Format::Alami::EN::w_dec
0000s0sDateTime::Format::Alami::EN::::w_febDateTime::Format::Alami::EN::w_feb
0000s0sDateTime::Format::Alami::EN::::w_fridayDateTime::Format::Alami::EN::w_friday
0000s0sDateTime::Format::Alami::EN::::w_hourDateTime::Format::Alami::EN::w_hour
0000s0sDateTime::Format::Alami::EN::::w_janDateTime::Format::Alami::EN::w_jan
0000s0sDateTime::Format::Alami::EN::::w_julDateTime::Format::Alami::EN::w_jul
0000s0sDateTime::Format::Alami::EN::::w_junDateTime::Format::Alami::EN::w_jun
0000s0sDateTime::Format::Alami::EN::::w_marDateTime::Format::Alami::EN::w_mar
0000s0sDateTime::Format::Alami::EN::::w_mayDateTime::Format::Alami::EN::w_may
0000s0sDateTime::Format::Alami::EN::::w_minuteDateTime::Format::Alami::EN::w_minute
0000s0sDateTime::Format::Alami::EN::::w_mondayDateTime::Format::Alami::EN::w_monday
0000s0sDateTime::Format::Alami::EN::::w_monthDateTime::Format::Alami::EN::w_month
0000s0sDateTime::Format::Alami::EN::::w_novDateTime::Format::Alami::EN::w_nov
0000s0sDateTime::Format::Alami::EN::::w_octDateTime::Format::Alami::EN::w_oct
0000s0sDateTime::Format::Alami::EN::::w_saturdayDateTime::Format::Alami::EN::w_saturday
0000s0sDateTime::Format::Alami::EN::::w_secondDateTime::Format::Alami::EN::w_second
0000s0sDateTime::Format::Alami::EN::::w_sepDateTime::Format::Alami::EN::w_sep
0000s0sDateTime::Format::Alami::EN::::w_sundayDateTime::Format::Alami::EN::w_sunday
0000s0sDateTime::Format::Alami::EN::::w_thursdayDateTime::Format::Alami::EN::w_thursday
0000s0sDateTime::Format::Alami::EN::::w_tuesdayDateTime::Format::Alami::EN::w_tuesday
0000s0sDateTime::Format::Alami::EN::::w_wednesdayDateTime::Format::Alami::EN::w_wednesday
0000s0sDateTime::Format::Alami::EN::::w_weekDateTime::Format::Alami::EN::w_week
0000s0sDateTime::Format::Alami::EN::::w_yearDateTime::Format::Alami::EN::w_year
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DateTime::Format::Alami::EN;
2
31900nsour $DATE = '2016-06-30'; # DATE
41200nsour $VERSION = '0.11'; # VERSION
5
6285µs139µs
# spent 39µs within DateTime::Format::Alami::EN::BEGIN@6 which was called: # once (39µs+0s) by main::BEGIN@0 at line 6
use 5.014000;
# spent 39µs making 1 call to DateTime::Format::Alami::EN::BEGIN@6
72595µs2976µs
# spent 971µs (872+98) within DateTime::Format::Alami::EN::BEGIN@7 which was called: # once (872µs+98µs) by main::BEGIN@0 at line 7
use strict;
# spent 971µs making 1 call to DateTime::Format::Alami::EN::BEGIN@7 # spent 6µs making 1 call to strict::import
823.85ms24.06ms
# spent 4.05ms (3.98+71µs) within DateTime::Format::Alami::EN::BEGIN@8 which was called: # once (3.98ms+71µs) by main::BEGIN@0 at line 8
use warnings;
# spent 4.05ms making 1 call to DateTime::Format::Alami::EN::BEGIN@8 # spent 13µs making 1 call to warnings::import
9
10# XXX holidays -> christmas | new year | ...
11# XXX timezone in time
12# XXX more patterns from DF:Natural
13
1421.29ms22.24ms
# spent 2.16ms (788µs+1.37) within DateTime::Format::Alami::EN::BEGIN@14 which was called: # once (788µs+1.37ms) by main::BEGIN@0 at line 14
use Parse::Number::EN qw(parse_number_en);
# spent 2.16ms making 1 call to DateTime::Format::Alami::EN::BEGIN@14 # spent 83µs making 1 call to Exporter::import
15
16sub o_num { $Parse::Number::EN::Pat }
17sub _parse_num { parse_number_en(text => $_[1]) }
18sub w_year { ["year", "years", "y"] }
19sub w_month { ["month", "months", "mon"] }
20sub w_week { ["week", "weeks", "wk", "wks"] }
21sub w_day { ["day", "days", "d"] }
22sub w_hour { ["hour", "hours", "h"] }
23sub w_minute { ["minute", "minutes", "min", "mins"] }
24sub w_second { ["second", "seconds", "sec", "secs", "s"] }
25
26sub w_jan { ["january", "jan"] }
27sub w_feb { ["february", "feb"] }
28sub w_mar { ["march", "mar"] }
29sub w_apr { ["april", "apr"] }
30sub w_may { ["may"] }
31sub w_jun { ["june", "jun"] }
32sub w_jul { ["july", "jul"] }
33sub w_aug { ["august", "aug"] }
34sub w_sep { ["september", "sept", "sep"] }
35sub w_oct { ["october", "oct"] }
36sub w_nov { ["november", "nov"] }
37sub w_dec { ["december", "dec"] }
38
39sub w_monday { ["monday", "mon"] }
40sub w_tuesday { ["tuesday", "tue"] }
41sub w_wednesday { ["wednesday", "wed"] }
42sub w_thursday { ["thursday", "thu"] }
43sub w_friday { ["friday", "fri"] }
44sub w_saturday { ["saturday", "sat"] }
45sub w_sunday { ["sunday", "sun"] }
46
47sub p_now { "(?:(?:(?:right|just) \\s+ )?now|immediately)" }
48sub p_today { "(?:today|this \\s+ day)" }
49sub p_tomorrow { "(?:tomorrow|tom)" }
50sub p_yesterday { "(?:yesterday|yest)" }
51
52sub o_cardinal_suffix { '(?:\s*(?:th|nd|st))' }
53
54sub p_dateymd { join(
55 # we use the 'local' trick here in embedded code (see perlre) to be
56 # backtrack-safe. we want to unset $m->{o_yearint} when date does not
57 # contain year. $m->{o_yearint} might be set when we try the patterns but
58 # might end up needing to be unset if the matching pattern ends up not
59 # having year.
60 "",
61 '(?{ $DateTime::Format::Alami::_has_year = 0 })',
62 '(?: <o_dayint><o_cardinal_suffix>? (?:\\s*|[ /-]) <o_monthname> | <o_monthname> (?:\\s*|[ /-]) <o_dayint><o_cardinal_suffix>?\\b | <o_monthint>[/-]<o_dayint>\\b )',
63 '(?: \\s*[,/-]?\\s* <o_yearint> (?{ local $DateTime::Format::Alami::_has_year = $DateTime::Format::Alami::_has_year + 1 }))?',
64 '(?{ delete $DateTime::Format::Alami::m->{o_yearint} unless $DateTime::Format::Alami::_has_year })',
65)}
66
67sub p_dur_ago { "<o_dur> \\s+ (?:ago)" }
68sub p_dur_later { "<o_dur> \\s+ (?:later) | in \\s+ <o_dur>" }
69
70sub p_which_dow { join(
71 "",
72 '(?{ $DateTime::Format::Alami::_offset = 0 })',
73 "(?:",
74 ' (?: (?:last \s+)(?{ local $DateTime::Format::Alami::_offset = -1 }) | (?:next \s+)(?{ local $DateTime::Format::Alami::_offset = 1 }) | (?:this \s+)?)',
75 ' <o_dow>',
76 ")",
77 '(?{ $DateTime::Format::Alami::m->{offset} = $DateTime::Format::Alami::_offset })',
78)}
79
80sub o_date { "(?: <p_which_dow>|<p_today>|<p_tomorrow>|<p_yesterday>|<p_dateymd>)" }
81sub o_ampm { "(?: am|pm)" }
82sub p_time { "(?: <o_hour>[:.]<o_minute>(?: [:.]<o_second>)? \\s* <o_ampm>?)" } # XXX am/pm
83sub p_date_time { "(?:<o_date> \\s+ (?:(?:on|at) \\s+)? <p_time>)" }
84
85# the ordering is a bit weird because: we need to apply role at compile-time
86# before the precomputed $RE mentions $o & $m thus creating the package
87# DateTime::Format::Alami and this makes Role::Tiny::With complains that DT:F:A
88# is not a role. then, if we are to apply the role, we need to already declare
89# the methods required by the role.
90
912306µs25.99ms
# spent 5.94ms (533µs+5.41) within DateTime::Format::Alami::EN::BEGIN@91 which was called: # once (533µs+5.41ms) by main::BEGIN@0 at line 91
use Role::Tiny::With;
# spent 5.94ms making 1 call to DateTime::Format::Alami::EN::BEGIN@91 # spent 51µs making 1 call to Exporter::import
9212.03ms250.8ms
# spent 25.4ms (10µs+25.4) within DateTime::Format::Alami::EN::BEGIN@92 which was called: # once (10µs+25.4ms) by main::BEGIN@0 at line 92
BEGIN { with 'DateTime::Format::Alami' };
# spent 25.4ms making 1 call to DateTime::Format::Alami::EN::BEGIN@92 # spent 25.4ms making 1 call to Role::Tiny::With::with
93
941000167.4ms30012.46sour $RE_DT = qr(((?&top))(?(DEFINE)(?<top>(?&p_date_time)|(?&p_dur_later)|(?&p_dur_ago)|(?&p_time)|(?&p_which_dow)|(?&p_today)|(?&p_tomorrow)|(?&p_yesterday)|(?&p_dateymd)|(?&p_now))(?<p_date_time> (\b (?:(?&o_date) \s+ (?:(?:on|at) \s+)? (?&p_time)) \b)(?{ $DateTime::Format::Alami::m->{p_date_time} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_date_time"; $DateTime::Format::Alami::o->a_date_time($DateTime::Format::Alami::m) }))(?<p_dur_later> (\b (?&o_dur) \s+ (?:later) | in \s+ (?&o_dur) \b)(?{ $DateTime::Format::Alami::m->{p_dur_later} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_dur_later"; $DateTime::Format::Alami::o->a_dur_later($DateTime::Format::Alami::m) }))(?<p_dur_ago> (\b (?&o_dur) \s+ (?:ago) \b)(?{ $DateTime::Format::Alami::m->{p_dur_ago} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_dur_ago"; $DateTime::Format::Alami::o->a_dur_ago($DateTime::Format::Alami::m) }))(?<o_date> ((?: (?&p_which_dow)|(?&p_today)|(?&p_tomorrow)|(?&p_yesterday)|(?&p_dateymd)))(?{ $DateTime::Format::Alami::m->{o_date} = $^N }))(?<p_time> (\b (?: (?&o_hour)[:.](?&o_minute)(?: [:.](?&o_second))? \s* (?&o_ampm)?) \b)(?{ $DateTime::Format::Alami::m->{p_time} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_time"; $DateTime::Format::Alami::o->a_time($DateTime::Format::Alami::m) }))(?<o_dur> ((?:((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?)\s*(?:year|years|y|month|months|mon|week|weeks|wk|wks|day|days|d|hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s)\s*(?:,\s*)?)+))(?{ $DateTime::Format::Alami::m->{o_dur} = $^N }))(?<p_which_dow> (\b (?{ $DateTime::Format::Alami::_offset = 0 })(?: (?: (?:last \s+)(?{ local $DateTime::Format::Alami::_offset = -1 }) | (?:next \s+)(?{ local $DateTime::Format::Alami::_offset = 1 }) | (?:this \s+)?) (?&o_dow))(?{ $DateTime::Format::Alami::m->{offset} = $DateTime::Format::Alami::_offset }) \b)(?{ $DateTime::Format::Alami::m->{p_which_dow} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_which_dow"; $DateTime::Format::Alami::o->a_which_dow($DateTime::Format::Alami::m) }))(?<p_today> (\b (?:today|this \s+ day) \b)(?{ $DateTime::Format::Alami::m->{p_today} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_today"; $DateTime::Format::Alami::o->a_today($DateTime::Format::Alami::m) }))(?<p_tomorrow> (\b (?:tomorrow|tom) \b)(?{ $DateTime::Format::Alami::m->{p_tomorrow} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_tomorrow"; $DateTime::Format::Alami::o->a_tomorrow($DateTime::Format::Alami::m) }))(?<p_yesterday> (\b (?:yesterday|yest) \b)(?{ $DateTime::Format::Alami::m->{p_yesterday} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_yesterday"; $DateTime::Format::Alami::o->a_yesterday($DateTime::Format::Alami::m) }))(?<p_dateymd> (\b (?{ $DateTime::Format::Alami::_has_year = 0 })(?: (?&o_dayint)(?&o_cardinal_suffix)? (?:\s*|[ /-]) (?&o_monthname) | (?&o_monthname) (?:\s*|[ /-]) (?&o_dayint)(?&o_cardinal_suffix)?\b | (?&o_monthint)[/-](?&o_dayint)\b )(?: \s*[,/-]?\s* (?&o_yearint) (?{ local $DateTime::Format::Alami::_has_year = $DateTime::Format::Alami::_has_year + 1 }))?(?{ delete $DateTime::Format::Alami::m->{o_yearint} unless $DateTime::Format::Alami::_has_year }) \b)(?{ $DateTime::Format::Alami::m->{p_dateymd} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_dateymd"; $DateTime::Format::Alami::o->a_dateymd($DateTime::Format::Alami::m) }))(?<o_hour> ((?:[0-9][0-9]?))(?{ $DateTime::Format::Alami::m->{o_hour} = $^N }))(?<o_minute> ((?:[0-9][0-9]?))(?{ $DateTime::Format::Alami::m->{o_minute} = $^N }))(?<o_second> ((?:[0-9][0-9]?))(?{ $DateTime::Format::Alami::m->{o_second} = $^N }))(?<o_ampm> ((?: am|pm))(?{ $DateTime::Format::Alami::m->{o_ampm} = $^N }))(?<o_dow> ((?:monday|mon|tuesday|tue|wednesday|wed|thursday|thu|friday|fri|saturday|sat|sunday|sun))(?{ $DateTime::Format::Alami::m->{o_dow} = $^N }))(?<o_monthname> ((?:january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec))(?{ $DateTime::Format::Alami::m->{o_monthname} = $^N }))(?<o_cardinal_suffix> ((?:\s*(?:th|nd|st)))(?{ $DateTime::Format::Alami::m->{o_cardinal_suffix} = $^N }))(?<o_monthint> ((?:0?[1-9]|1[012]))(?{ $DateTime::Format::Alami::m->{o_monthint} = $^N }))(?<o_dayint> ((?:[12][0-9]|3[01]|0?[1-9]))(?{ $DateTime::Format::Alami::m->{o_dayint} = $^N }))(?<o_yearint> ((?:[0-9]{4}|[0-9]{2}))(?{ $DateTime::Format::Alami::m->{o_yearint} = $^N }))(?<o_timedur> ((?:((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?)\s*(?:hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s)\s*(?:,\s*)?)+))(?{ $DateTime::Format::Alami::m->{o_timedur} = $^N }))(?<p_now> (\b (?:(?:(?:right|just) \s+ )?now|immediately) \b)(?{ $DateTime::Format::Alami::m->{p_now} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_now"; $DateTime::Format::Alami::o->a_now($DateTime::Format::Alami::m) }))(?<o_durwords> ((?:year|years|y|month|months|mon|week|weeks|wk|wks|day|days|d|hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s))(?{ $DateTime::Format::Alami::m->{o_durwords} = $^N }))(?<o_num> ((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?))(?{ $DateTime::Format::Alami::m->{o_num} = $^N }))(?<o_timedurwords> ((?:hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s))(?{ $DateTime::Format::Alami::m->{o_timedurwords} = $^N }))))ix; # PRECOMPUTED FROM: do { DateTime::Format::Alami::EN->new; $DateTime::Format::Alami::EN::RE_DT }
# spent 2.46s making 3000 calls to DateTime::Format::Alami::a_dateymd, avg 821µs/call # spent 18µs making 1 call to DateTime::Format::Alami::EN::CORE:qr
95114µs12µsour $RE_DUR = qr((?&top)(?(DEFINE)(?<top>(?&pdur_dur))(?<pdur_dur> (\b (?:(?&odur_dur)) \b)(?{ $DateTime::Format::Alami::m->{pdur_dur} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "pdur_dur"; $DateTime::Format::Alami::o->adur_dur($DateTime::Format::Alami::m) }))(?<odur_dur> ((?:((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?)\s*(?:year|years|y|month|months|mon|week|weeks|wk|wks|day|days|d|hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s)\s*(?:,\s*)?)+))(?{ $DateTime::Format::Alami::m->{odur_dur} = $^N }))))ix; # PRECOMPUTED FROM: do { DateTime::Format::Alami::EN->new; $DateTime::Format::Alami::EN::RE_DUR }
# spent 2µs making 1 call to DateTime::Format::Alami::EN::CORE:qr
96116µsour $MAPS = {dow=>{fri=>5,friday=>5,mon=>1,monday=>1,sat=>6,saturday=>6,sun=>7,sunday=>7,thu=>4,thursday=>4,tue=>2,tuesday=>2,wed=>3,wednesday=>3},months=>{apr=>4,april=>4,aug=>8,august=>8,dec=>12,december=>12,feb=>2,february=>2,jan=>1,january=>1,jul=>7,july=>7,jun=>6,june=>6,mar=>3,march=>3,may=>5,nov=>11,november=>11,oct=>10,october=>10,sep=>9,sept=>9,september=>9}}; # PRECOMPUTED FROM: do { DateTime::Format::Alami::EN->new; $DateTime::Format::Alami::EN::MAPS }
97
98113µs1;
99# ABSTRACT: Parse human date/time/duration expression (English)
100
101__END__
 
# spent 21µs within DateTime::Format::Alami::EN::CORE:qr which was called 2 times, avg 10µs/call: # once (18µs+0s) by main::BEGIN@0 at line 94 # once (2µs+0s) by main::BEGIN@0 at line 95
sub DateTime::Format::Alami::EN::CORE:qr; # opcode