Profile of version/regex.pm

← 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/x86_64-linux/version/regex.pm
Statements | Executed 18 statements in 745µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
6 | 6 | 1 | 168µs | 168µs | version::regex::::CORE:regcompversion::regex::CORE:regcomp (opcode)
1 | 1 | 1 | 35µs | 40µs | version::regex::::BEGIN@3version::regex::BEGIN@3
12 | 12 | 1 | 19µs | 19µs | version::regex::::CORE:qrversion::regex::CORE:qr (opcode)
1 | 1 | 1 | 10µs | 79µs | version::regex::::BEGIN@5version::regex::BEGIN@5
0 | 0 | 0 | 0s | 0s | version::regex::::is_laxversion::regex::is_lax
0 | 0 | 0 | 0s | 0s | version::regex::::is_strictversion::regex::is_strict

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package version::regex;
2 |  |  |  |  |
3 | 2 | 49µs | 2 | 44µs | # spent 40µs (35+5) within version::regex::BEGIN@3 which was called: # once (35µs+5µs) by experimental::BEGIN@5 at line 3 use strict; # spent 40µs making 1 call to version::regex::BEGIN@3 # spent 4µs making 1 call to strict::import
4 |  |  |  |  |
5 | 2 | 412µs | 2 | 148µs | # spent 79µs (10+69) within version::regex::BEGIN@5 which was called: # once (10µs+69µs) by experimental::BEGIN@5 at line 5 use vars qw($VERSION $CLASS $STRICT $LAX); # spent 79µs making 1 call to version::regex::BEGIN@5 # spent 69µs making 1 call to vars::import
6 |  |  |  |  |
7 | 1 | 600ns |  |  | $VERSION = 0.9916;
8 |  |  |  |  |
9 |  |  |  |  | #--------------------------------------------------------------------------#
10 |  |  |  |  | # Version regexp components
11 |  |  |  |  | #--------------------------------------------------------------------------#
12 |  |  |  |  |
13 |  |  |  |  | # Fraction part of a decimal version number. This is a common part of
14 |  |  |  |  | # both strict and lax decimal versions
15 |  |  |  |  |
16 | 1 | 12µs | 1 | 4µs | my $FRACTION_PART = qr/\.[0-9]+/; # spent 4µs making 1 call to version::regex::CORE:qr
17 |  |  |  |  |
18 |  |  |  |  | # First part of either decimal or dotted-decimal strict version number.
19 |  |  |  |  | # Unsigned integer with no leading zeroes (except for zero itself) to
20 |  |  |  |  | # avoid confusion with octal.
21 |  |  |  |  |
22 | 1 | 4µs | 1 | 1µs | my $STRICT_INTEGER_PART = qr/0|[1-9][0-9]*/; # spent 1µs making 1 call to version::regex::CORE:qr
23 |  |  |  |  |
24 |  |  |  |  | # First part of either decimal or dotted-decimal lax version number.
25 |  |  |  |  | # Unsigned integer, but allowing leading zeros. Always interpreted
26 |  |  |  |  | # as decimal. However, some forms of the resulting syntax give odd
27 |  |  |  |  | # results if used as ordinary Perl expressions, due to how perl treats
28 |  |  |  |  | # octals. E.g.
29 |  |  |  |  | # version->new("010" ) == 10
30 |  |  |  |  | # version->new( 010 ) == 8
31 |  |  |  |  | # version->new( 010.2) == 82 # "8" . "2"
32 |  |  |  |  |
33 | 1 | 4µs | 1 | 800ns | my $LAX_INTEGER_PART = qr/[0-9]+/; # spent 800ns making 1 call to version::regex::CORE:qr
34 |  |  |  |  |
35 |  |  |  |  | # Second and subsequent part of a strict dotted-decimal version number.
36 |  |  |  |  | # Leading zeroes are permitted, and the number is always decimal.
37 |  |  |  |  | # Limited to three digits to avoid overflow when converting to decimal
38 |  |  |  |  | # form and also avoid problematic style with excessive leading zeroes.
39 |  |  |  |  |
40 | 1 | 4µs | 1 | 900ns | my $STRICT_DOTTED_DECIMAL_PART = qr/\.[0-9]{1,3}/; # spent 900ns making 1 call to version::regex::CORE:qr
41 |  |  |  |  |
42 |  |  |  |  | # Second and subsequent part of a lax dotted-decimal version number.
43 |  |  |  |  | # Leading zeroes are permitted, and the number is always decimal. No
44 |  |  |  |  | # limit on the numerical value or number of digits, so there is the
45 |  |  |  |  | # possibility of overflow when converting to decimal form.
46 |  |  |  |  |
47 | 1 | 3µs | 1 | 700ns | my $LAX_DOTTED_DECIMAL_PART = qr/\.[0-9]+/; # spent 700ns making 1 call to version::regex::CORE:qr
48 |  |  |  |  |
49 |  |  |  |  | # Alpha suffix part of lax version number syntax. Acts like a
50 |  |  |  |  | # dotted-decimal part.
51 |  |  |  |  |
52 | 1 | 4µs | 1 | 600ns | my $LAX_ALPHA_PART = qr/_[0-9]+/; # spent 600ns making 1 call to version::regex::CORE:qr
53 |  |  |  |  |
54 |  |  |  |  | #--------------------------------------------------------------------------#
55 |  |  |  |  | # Strict version regexp definitions
56 |  |  |  |  | #--------------------------------------------------------------------------#
57 |  |  |  |  |
58 |  |  |  |  | # Strict decimal version number.
59 |  |  |  |  |
60 | 1 | 40µs | 2 | 30µs | my $STRICT_DECIMAL_VERSION = # spent 29µs making 1 call to version::regex::CORE:regcomp # spent 1µs making 1 call to version::regex::CORE:qr
61 |  |  |  |  | qr/ $STRICT_INTEGER_PART $FRACTION_PART? /x;
62 |  |  |  |  |
63 |  |  |  |  | # Strict dotted-decimal version number. Must have both leading "v" and
64 |  |  |  |  | # at least three parts, to avoid confusion with decimal syntax.
65 |  |  |  |  |
66 | 1 | 27µs | 2 | 19µs | my $STRICT_DOTTED_DECIMAL_VERSION = # spent 17µs making 1 call to version::regex::CORE:regcomp # spent 2µs making 1 call to version::regex::CORE:qr
67 |  |  |  |  | qr/ v $STRICT_INTEGER_PART $STRICT_DOTTED_DECIMAL_PART{2,} /x;
68 |  |  |  |  |
69 |  |  |  |  | # Complete strict version number syntax -- should generally be used
70 |  |  |  |  | # anchored: qr/ \A $STRICT \z /x
71 |  |  |  |  |
72 | 1 | 36µs | 2 | 28µs | $STRICT = # spent 27µs making 1 call to version::regex::CORE:regcomp # spent 1µs making 1 call to version::regex::CORE:qr
73 |  |  |  |  | qr/ $STRICT_DECIMAL_VERSION | $STRICT_DOTTED_DECIMAL_VERSION /x;
74 |  |  |  |  |
75 |  |  |  |  | #--------------------------------------------------------------------------#
76 |  |  |  |  | # Lax version regexp definitions
77 |  |  |  |  | #--------------------------------------------------------------------------#
78 |  |  |  |  |
79 |  |  |  |  | # Lax decimal version number. Just like the strict one except for
80 |  |  |  |  | # allowing an alpha suffix or allowing a leading or trailing
81 |  |  |  |  | # decimal-point
82 |  |  |  |  |
83 | 1 | 40µs | 2 | 32µs | my $LAX_DECIMAL_VERSION = # spent 27µs making 1 call to version::regex::CORE:regcomp # spent 5µs making 1 call to version::regex::CORE:qr
84 |  |  |  |  | qr/ $LAX_INTEGER_PART (?: \. | $FRACTION_PART $LAX_ALPHA_PART? )?
85 |  |  |  |  | |
86 |  |  |  |  | $FRACTION_PART $LAX_ALPHA_PART?
87 |  |  |  |  | /x;
88 |  |  |  |  |
89 |  |  |  |  | # Lax dotted-decimal version number. Distinguished by having either
90 |  |  |  |  | # leading "v" or at least three non-alpha parts. Alpha part is only
91 |  |  |  |  | # permitted if there are at least two non-alpha parts. Strangely
92 |  |  |  |  | # enough, without the leading "v", Perl takes .1.2 to mean v0.1.2,
93 |  |  |  |  | # so when there is no "v", the leading part is optional
94 |  |  |  |  |
95 | 1 | 32µs | 2 | 25µs | my $LAX_DOTTED_DECIMAL_VERSION = # spent 24µs making 1 call to version::regex::CORE:regcomp # spent 1µs making 1 call to version::regex::CORE:qr
96 |  |  |  |  | qr/
97 |  |  |  |  | v $LAX_INTEGER_PART (?: $LAX_DOTTED_DECIMAL_PART+ $LAX_ALPHA_PART? )?
98 |  |  |  |  | |
99 |  |  |  |  | $LAX_INTEGER_PART? $LAX_DOTTED_DECIMAL_PART{2,} $LAX_ALPHA_PART?
100 |  |  |  |  | /x;
101 |  |  |  |  |
102 |  |  |  |  | # Complete lax version number syntax -- should generally be used
103 |  |  |  |  | # anchored: qr/ \A $LAX \z /x
104 |  |  |  |  | #
105 |  |  |  |  | # The string 'undef' is a special case to make for easier handling
106 |  |  |  |  | # of return values from ExtUtils::MM->parse_version
107 |  |  |  |  |
108 | 1 | 53µs | 2 | 44µs | $LAX = # spent 43µs making 1 call to version::regex::CORE:regcomp # spent 1µs making 1 call to version::regex::CORE:qr
109 |  |  |  |  | qr/ undef | $LAX_DECIMAL_VERSION | $LAX_DOTTED_DECIMAL_VERSION /x;
110 |  |  |  |  |
111 |  |  |  |  | #--------------------------------------------------------------------------#
112 |  |  |  |  |
113 |  |  |  |  | # Preloaded methods go here.
114 |  |  |  |  | sub is_strict { defined $_[0] && $_[0] =~ qr/ \A $STRICT \z /x }
115 |  |  |  |  | sub is_lax { defined $_[0] && $_[0] =~ qr/ \A $LAX \z /x }
116 |  |  |  |  |
117 | 1 | 24µs |  |  | 1;
|  |  |  |  | # spent 19µs within version::regex::CORE:qr which was called 12 times, avg 2µs/call: # once (5µs+0s) by experimental::BEGIN@5 at line 83 # once (4µs+0s) by experimental::BEGIN@5 at line 16 # once (2µs+0s) by experimental::BEGIN@5 at line 66 # once (1µs+0s) by experimental::BEGIN@5 at line 72 # once (1µs+0s) by experimental::BEGIN@5 at line 22 # once (1µs+0s) by experimental::BEGIN@5 at line 95 # once (1µs+0s) by experimental::BEGIN@5 at line 108 # once (1µs+0s) by experimental::BEGIN@5 at line 60 # once (900ns+0s) by experimental::BEGIN@5 at line 40 # once (800ns+0s) by experimental::BEGIN@5 at line 33 # once (700ns+0s) by experimental::BEGIN@5 at line 47 # once (600ns+0s) by experimental::BEGIN@5 at line 52 sub version::regex::CORE:qr; # opcode
|  |  |  |  | # spent 168µs within version::regex::CORE:regcomp which was called 6 times, avg 28µs/call: # once (43µs+0s) by experimental::BEGIN@5 at line 108 # once (29µs+0s) by experimental::BEGIN@5 at line 60 # once (27µs+0s) by experimental::BEGIN@5 at line 72 # once (27µs+0s) by experimental::BEGIN@5 at line 83 # once (24µs+0s) by experimental::BEGIN@5 at line 95 # once (17µs+0s) by experimental::BEGIN@5 at line 66 sub version::regex::CORE:regcomp; # opcode