Profile of Class/XSAccessor/Array.pm

← Index
NYTProf Performance Profile «line view»
For t/optimization.t
Run on Thu Jan 8 22:47:42 2015
Reported on Thu Jan 8 22:48:05 2015

Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/x86_64-linux/Class/XSAccessor/Array.pm
Statements | Executed 129 statements in 940µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 775µs | 1.78ms | Class::XSAccessor::Array::::BEGIN@6Class::XSAccessor::Array::BEGIN@6
7 | 2 | 1 | 106µs | 246µs | Class::XSAccessor::Array::::_generate_methodClass::XSAccessor::Array::_generate_method
2 | 2 | 2 | 103µs | 349µs | Class::XSAccessor::Array::::importClass::XSAccessor::Array::import
5 | 1 | 1 | 31µs | 31µs | Class::XSAccessor::Array::::newxs_accessorClass::XSAccessor::Array::newxs_accessor (xsub)
1 | 1 | 1 | 22µs | 22µs | Class::XSAccessor::Array::::BEGIN@2Class::XSAccessor::Array::BEGIN@2
1 | 1 | 1 | 12µs | 24µs | Class::XSAccessor::Array::::BEGIN@62Class::XSAccessor::Array::BEGIN@62
1 | 1 | 1 | 10µs | 24µs | Class::XSAccessor::Array::::BEGIN@3Class::XSAccessor::Array::BEGIN@3
1 | 1 | 1 | 10µs | 14µs | Class::XSAccessor::Array::::BEGIN@4Class::XSAccessor::Array::BEGIN@4
1 | 1 | 1 | 9µs | 42µs | Class::XSAccessor::Array::::BEGIN@5Class::XSAccessor::Array::BEGIN@5
2 | 1 | 1 | 8µs | 8µs | Class::XSAccessor::Array::::newxs_constructorClass::XSAccessor::Array::newxs_constructor (xsub)
1 | 1 | 1 | 7µs | 7µs | Class::XSAccessor::Array::::BEGIN@7Class::XSAccessor::Array::BEGIN@7
7 | 1 | 1 | 5µs | 5µs | Class::XSAccessor::Array::::CORE:matchClass::XSAccessor::Array::CORE:match (opcode)

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Class::XSAccessor::Array;
2 | 2 | 56µs | 1 | 22µs | # spent 22µs within Class::XSAccessor::Array::BEGIN@2 which was called: # once (22µs+0s) by Data::DPath::Step::BEGIN@8 at line 2 use 5.008; # spent 22µs making 1 call to Class::XSAccessor::Array::BEGIN@2
3 | 2 | 25µs | 2 | 39µs | # spent 24µs (10+15) within Class::XSAccessor::Array::BEGIN@3 which was called: # once (10µs+15µs) by Data::DPath::Step::BEGIN@8 at line 3 use strict; # spent 24µs making 1 call to Class::XSAccessor::Array::BEGIN@3 # spent 15µs making 1 call to strict::import
4 | 2 | 26µs | 2 | 19µs | # spent 14µs (10+5) within Class::XSAccessor::Array::BEGIN@4 which was called: # once (10µs+5µs) by Data::DPath::Step::BEGIN@8 at line 4 use warnings; # spent 14µs making 1 call to Class::XSAccessor::Array::BEGIN@4 # spent 5µs making 1 call to warnings::import
5 | 2 | 27µs | 2 | 74µs | # spent 42µs (9+32) within Class::XSAccessor::Array::BEGIN@5 which was called: # once (9µs+32µs) by Data::DPath::Step::BEGIN@8 at line 5 use Carp qw/croak/; # spent 42µs making 1 call to Class::XSAccessor::Array::BEGIN@5 # spent 32µs making 1 call to Exporter::import
6 | 2 | 104µs | 2 | 1.84ms | # spent 1.78ms (775µs+1.01) within Class::XSAccessor::Array::BEGIN@6 which was called: # once (775µs+1.01ms) by Data::DPath::Step::BEGIN@8 at line 6 use Class::XSAccessor; # spent 1.78ms making 1 call to Class::XSAccessor::Array::BEGIN@6 # spent 58µs making 1 call to Class::XSAccessor::import
7 | 2 | 314µs | 1 | 7µs | # spent 7µs within Class::XSAccessor::Array::BEGIN@7 which was called: # once (7µs+0s) by Data::DPath::Step::BEGIN@8 at line 7 use Class::XSAccessor::Heavy; # spent 7µs making 1 call to Class::XSAccessor::Array::BEGIN@7
8 |  |  |  |  |
9 | 1 | 600ns |  |  | our $VERSION = '1.14';
10 |  |  |  |  |
11 |  |  |  |  | # spent 349µs (103+246) within Class::XSAccessor::Array::import which was called 2 times, avg 174µs/call: # once (51µs+142µs) by Data::DPath::Step::BEGIN@8 at line 8 of lib/Data/DPath/Step.pm # once (52µs+104µs) by Data::DPath::Context::BEGIN@45 at line 45 of lib/Data/DPath/Context.pm sub import {
12 | 2 | 1µs |  |  | my $own_class = shift;
13 | 2 | 3µs |  |  | my ($caller_pkg) = caller();
14 |  |  |  |  |
15 |  |  |  |  | # Support both { getters => ... } and plain getters => ...
16 | 2 | 7µs |  |  | my %opts = ref($_[0]) eq 'HASH' ? %{$_[0]} : @_;
17 |  |  |  |  |
18 | 2 | 1µs |  |  | $caller_pkg = $opts{class} if defined $opts{class};
19 |  |  |  |  |
20 | 2 | 2µs |  |  | my $read_subs = $opts{getters} || {};
21 | 2 | 1µs |  |  | my $set_subs = $opts{setters} || {};
22 | 2 | 1µs |  |  | my $acc_subs = $opts{accessors} || {};
23 | 2 | 1µs |  |  | my $lvacc_subs = $opts{lvalue_accessors} || {};
24 | 2 | 900ns |  |  | my $pred_subs = $opts{predicates} || {};
25 | 2 | 3µs |  |  | my $construct_subs = $opts{constructors} || [defined($opts{constructor}) ? $opts{constructor} : ()];
26 | 2 | 1µs |  |  | my $true_subs = $opts{true} || [];
27 | 2 | 800ns |  |  | my $false_subs = $opts{false} || [];
28 |  |  |  |  |
29 |  |  |  |  |
30 | 2 | 8µs |  |  | foreach my $subtype ( ["getter", $read_subs],
31 |  |  |  |  | ["setter", $set_subs],
32 |  |  |  |  | ["accessor", $acc_subs],
33 |  |  |  |  | ["lvalue_accessor", $lvacc_subs],
34 |  |  |  |  | ["pred_subs", $pred_subs] )
35 |  |  |  |  | {
36 | 10 | 3µs |  |  | my $subs = $subtype->[1];
37 | 10 | 17µs |  |  | foreach my $subname (keys %$subs) {
38 | 5 | 3µs |  |  | my $array_index = $subs->{$subname};
39 | 5 | 14µs | 5 | 189µs | _generate_method($caller_pkg, $subname, $array_index, \%opts, $subtype->[0]); # spent 189µs making 5 calls to Class::XSAccessor::Array::_generate_method, avg 38µs/call
40 |  |  |  |  | }
41 |  |  |  |  | }
42 |  |  |  |  |
43 | 2 | 17µs |  |  | foreach my $subtype ( ["constructor", $construct_subs],
44 |  |  |  |  | ["true", $true_subs],
45 |  |  |  |  | ["false", $false_subs] )
46 |  |  |  |  | {
47 | 6 | 6µs |  |  | foreach my $subname (@{$subtype->[1]}) {
48 | 2 | 5µs | 2 | 57µs | _generate_method($caller_pkg, $subname, "", \%opts, $subtype->[0]); # spent 57µs making 2 calls to Class::XSAccessor::Array::_generate_method, avg 29µs/call
49 |  |  |  |  | }
50 |  |  |  |  | }
51 |  |  |  |  | }
52 |  |  |  |  |
53 |  |  |  |  | # spent 246µs (106+141) within Class::XSAccessor::Array::_generate_method which was called 7 times, avg 35µs/call: # 5 times (79µs+110µs) by Class::XSAccessor::Array::import at line 39, avg 38µs/call # 2 times (26µs+31µs) by Class::XSAccessor::Array::import at line 48, avg 29µs/call sub _generate_method {
54 | 7 | 7µs |  |  | my ($caller_pkg, $subname, $array_index, $opts, $type) = @_;
55 |  |  |  |  |
56 | 7 | 2µs |  |  | croak("Cannot use undef as a array index for generating an XS $type accessor. (Sub: $subname)")
57 |  |  |  |  | if not defined $array_index;
58 |  |  |  |  |
59 | 7 | 33µs | 7 | 5µs | $subname = "${caller_pkg}::$subname" if $subname !~ /::/; # spent 5µs making 7 calls to Class::XSAccessor::Array::CORE:match, avg 714ns/call
60 |  |  |  |  |
61 | 7 | 11µs | 7 | 97µs | Class::XSAccessor::Heavy::check_sub_existence($subname) if not $opts->{replace}; # spent 97µs making 7 calls to Class::XSAccessor::Heavy::check_sub_existence, avg 14µs/call
62 | 2 | 137µs | 2 | 36µs | # spent 24µs (12+12) within Class::XSAccessor::Array::BEGIN@62 which was called: # once (12µs+12µs) by Data::DPath::Step::BEGIN@8 at line 62 no warnings 'redefine'; # don't warn about an explicitly requested redefine # spent 24µs making 1 call to Class::XSAccessor::Array::BEGIN@62 # spent 12µs making 1 call to warnings::unimport
63 |  |  |  |  |
64 | 7 | 3µs |  |  | if ($type eq 'getter') {
65 |  |  |  |  | newxs_getter($subname, $array_index);
66 |  |  |  |  | }
67 | 7 | 45µs | 2 | 8µs | if ($type eq 'lvalue_accessor') { # spent 8µs making 2 calls to Class::XSAccessor::Array::newxs_constructor, avg 4µs/call
68 |  |  |  |  | newxs_lvalue_accessor($subname, $array_index);
69 |  |  |  |  | }
70 |  |  |  |  | elsif ($type eq 'setter') {
71 |  |  |  |  | newxs_setter($subname, $array_index, $opts->{chained}||0);
72 |  |  |  |  | }
73 |  |  |  |  | elsif ($type eq 'predicate') {
74 |  |  |  |  | newxs_predicate($subname, $array_index);
75 |  |  |  |  | }
76 |  |  |  |  | elsif ($type eq 'constructor') {
77 |  |  |  |  | newxs_constructor($subname);
78 |  |  |  |  | }
79 |  |  |  |  | elsif ($type eq 'true') {
80 |  |  |  |  | Class::XSAccessor::newxs_boolean($subname, 1);
81 |  |  |  |  | }
82 |  |  |  |  | elsif ($type eq 'false') {
83 |  |  |  |  | Class::XSAccessor::newxs_boolean($subname, 0);
84 |  |  |  |  | }
85 |  |  |  |  | else {
86 | 5 | 49µs | 5 | 31µs | newxs_accessor($subname, $array_index, $opts->{chained}||0); # spent 31µs making 5 calls to Class::XSAccessor::Array::newxs_accessor, avg 6µs/call
87 |  |  |  |  | }
88 |  |  |  |  | }
89 |  |  |  |  |
90 | 1 | 3µs |  |  | 1;
91 |  |  |  |  |
92 |  |  |  |  | __END__
|  |  |  |  | # spent 5µs within Class::XSAccessor::Array::CORE:match which was called 7 times, avg 714ns/call: # 7 times (5µs+0s) by Class::XSAccessor::Array::_generate_method at line 59, avg 714ns/call sub Class::XSAccessor::Array::CORE:match; # opcode
|  |  |  |  | # spent 31µs within Class::XSAccessor::Array::newxs_accessor which was called 5 times, avg 6µs/call: # 5 times (31µs+0s) by Class::XSAccessor::Array::_generate_method at line 86, avg 6µs/call sub Class::XSAccessor::Array::newxs_accessor; # xsub
|  |  |  |  | # spent 8µs within Class::XSAccessor::Array::newxs_constructor which was called 2 times, avg 4µs/call: # 2 times (8µs+0s) by Class::XSAccessor::Array::_generate_method at line 67, avg 4µs/call sub Class::XSAccessor::Array::newxs_constructor; # xsub