Profile of version/regex.pm

← Index
NYTProf Performance Profile «line view»
For test.pl
Run on Mon Apr 5 14:31:27 2021
Reported on Mon Apr 5 14:31:40 2021

Filename | /home/leont/perl5/perlbrew/perls/perl-5.32.0/lib/5.32.0/version/regex.pm
Statements | Executed 16 statements in 440µs

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