← 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
StatementsExecuted 129 statements in 940µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111775µs1.78msClass::XSAccessor::Array::::BEGIN@6Class::XSAccessor::Array::BEGIN@6
721106µs246µsClass::XSAccessor::Array::::_generate_methodClass::XSAccessor::Array::_generate_method
222103µs349µsClass::XSAccessor::Array::::importClass::XSAccessor::Array::import
51131µs31µsClass::XSAccessor::Array::::newxs_accessorClass::XSAccessor::Array::newxs_accessor (xsub)
11122µs22µsClass::XSAccessor::Array::::BEGIN@2Class::XSAccessor::Array::BEGIN@2
11112µs24µsClass::XSAccessor::Array::::BEGIN@62Class::XSAccessor::Array::BEGIN@62
11110µs24µsClass::XSAccessor::Array::::BEGIN@3Class::XSAccessor::Array::BEGIN@3
11110µs14µsClass::XSAccessor::Array::::BEGIN@4Class::XSAccessor::Array::BEGIN@4
1119µs42µsClass::XSAccessor::Array::::BEGIN@5Class::XSAccessor::Array::BEGIN@5
2118µs8µsClass::XSAccessor::Array::::newxs_constructorClass::XSAccessor::Array::newxs_constructor (xsub)
1117µs7µsClass::XSAccessor::Array::::BEGIN@7Class::XSAccessor::Array::BEGIN@7
7115µs5µsClass::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
1package Class::XSAccessor::Array;
2256µs122µ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
3225µs239µ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
4226µs219µ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
5227µs274µ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
62104µs21.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
72314µs17µ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
91600nsour $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 {
1221µs my $own_class = shift;
1323µs my ($caller_pkg) = caller();
14
15 # Support both { getters => ... } and plain getters => ...
1627µs my %opts = ref($_[0]) eq 'HASH' ? %{$_[0]} : @_;
17
1821µs $caller_pkg = $opts{class} if defined $opts{class};
19
2022µs my $read_subs = $opts{getters} || {};
2121µs my $set_subs = $opts{setters} || {};
2221µs my $acc_subs = $opts{accessors} || {};
2321µs my $lvacc_subs = $opts{lvalue_accessors} || {};
242900ns my $pred_subs = $opts{predicates} || {};
2523µs my $construct_subs = $opts{constructors} || [defined($opts{constructor}) ? $opts{constructor} : ()];
2621µs my $true_subs = $opts{true} || [];
272800ns my $false_subs = $opts{false} || [];
28
29
3028µ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 {
36103µs my $subs = $subtype->[1];
371017µs foreach my $subname (keys %$subs) {
3853µs my $array_index = $subs->{$subname};
39514µs5189µ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
43217µs foreach my $subtype ( ["constructor", $construct_subs],
44 ["true", $true_subs],
45 ["false", $false_subs] )
46 {
4766µs foreach my $subname (@{$subtype->[1]}) {
4825µs257µ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 {
5477µs my ($caller_pkg, $subname, $array_index, $opts, $type) = @_;
55
5672µs croak("Cannot use undef as a array index for generating an XS $type accessor. (Sub: $subname)")
57 if not defined $array_index;
58
59733µs75µs $subname = "${caller_pkg}::$subname" if $subname !~ /::/;
# spent 5µs making 7 calls to Class::XSAccessor::Array::CORE:match, avg 714ns/call
60
61711µs797µ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
622137µs236µ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
6473µs if ($type eq 'getter') {
65 newxs_getter($subname, $array_index);
66 }
67745µs28µ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 {
86549µs531µ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
9013µs1;
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