Profile of overloading.pm

← Index
NYTProf Performance Profile «line view»
For t/bug-md-11.t
Run on Fri Mar 8 13:27:24 2024
Reported on Fri Mar 8 13:30:23 2024

Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/5.38.2/overloading.pm
Statements | Executed 18 statements in 245µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
3 | 3 | 2 | 16µs | 16µs | overloading::::unimportoverloading::unimport
1 | 1 | 1 | 9µs | 26µs | overloading::::BEGIN@2overloading::BEGIN@2
0 | 0 | 0 | 0s | 0s | overloading::::_ops_to_numsoverloading::_ops_to_nums
0 | 0 | 0 | 0s | 0s | overloading::::importoverloading::import

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package overloading;
2 | 2 | 213µs | 2 | 44µs | # spent 26µs (9+17) within overloading::BEGIN@2 which was called: # once (9µs+17µs) by Carp::BEGIN@169 at line 2 use warnings; # spent 26µs making 1 call to overloading::BEGIN@2 # spent 17µs making 1 call to warnings::import
3 |  |  |  |  |
4 | 1 | 400ns |  |  | our $VERSION = '0.02';
5 |  |  |  |  |
6 | 1 | 200ns |  |  | my $HINT_NO_AMAGIC = 0x01000000; # see perl.h
7 |  |  |  |  |
8 | 1 | 6µs |  |  | require 5.010001;
9 |  |  |  |  |
10 |  |  |  |  | sub _ops_to_nums {
11 |  |  |  |  | require overload::numbers;
12 |  |  |  |  |
13 |  |  |  |  | map { exists $overload::numbers::names{"($_"}
14 |  |  |  |  | ? $overload::numbers::names{"($_"}
15 |  |  |  |  | : do { require Carp; Carp::croak("'$_' is not a valid overload") }
16 |  |  |  |  | } @_;
17 |  |  |  |  | }
18 |  |  |  |  |
19 |  |  |  |  | sub import {
20 |  |  |  |  | my ( $class, @ops ) = @_;
21 |  |  |  |  |
22 |  |  |  |  | if ( @ops ) {
23 |  |  |  |  | if ( $^H{overloading} ) {
24 |  |  |  |  | vec($^H{overloading} , $_, 1) = 0 for _ops_to_nums(@ops);
25 |  |  |  |  | }
26 |  |  |  |  |
27 |  |  |  |  | if ( $^H{overloading} !~ /[^\0]/ ) {
28 |  |  |  |  | delete $^H{overloading};
29 |  |  |  |  | $^H &= ~$HINT_NO_AMAGIC;
30 |  |  |  |  | }
31 |  |  |  |  | } else {
32 |  |  |  |  | delete $^H{overloading};
33 |  |  |  |  | $^H &= ~$HINT_NO_AMAGIC;
34 |  |  |  |  | }
35 |  |  |  |  | }
36 |  |  |  |  |
37 |  |  |  |  | # spent 16µs within overloading::unimport which was called 3 times, avg 5µs/call: # once (6µs+0s) by overload::BEGIN@84 at line 84 of overload.pm # once (6µs+0s) by Carp::BEGIN@1 at line 1 of (eval 4)[Carp.pm:171] # once (4µs+0s) by overload::BEGIN@113 at line 113 of overload.pm sub unimport {
38 | 3 | 2µs |  |  | my ( $class, @ops ) = @_;
39 |  |  |  |  |
40 | 3 | 5µs |  |  | if ( exists $^H{overloading} or not $^H & $HINT_NO_AMAGIC ) {
41 |  |  |  |  | if ( @ops ) {
42 |  |  |  |  | vec($^H{overloading} ||= '', $_, 1) = 1 for _ops_to_nums(@ops);
43 |  |  |  |  | } else {
44 | 3 | 5µs |  |  | delete $^H{overloading};
45 |  |  |  |  | }
46 |  |  |  |  | }
47 |  |  |  |  |
48 | 3 | 11µs |  |  | $^H |= $HINT_NO_AMAGIC;
49 |  |  |  |  | }
50 |  |  |  |  |
51 | 1 | 3µs |  |  | 1;
52 |  |  |  |  | __END__