← Index
NYTProf Performance Profile   « line view »
For bin/benchmark-perlformance
  Run on Fri Apr 17 15:31:48 2015
Reported on Fri Apr 17 15:32:02 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 733µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111535µs1.24msClass::XSAccessor::Array::::BEGIN@6Class::XSAccessor::Array::BEGIN@6
72190µs212µsClass::XSAccessor::Array::::_generate_methodClass::XSAccessor::Array::_generate_method
22287µs299µsClass::XSAccessor::Array::::importClass::XSAccessor::Array::import
51128µs28µsClass::XSAccessor::Array::::newxs_accessorClass::XSAccessor::Array::newxs_accessor (xsub)
11116µs16µsClass::XSAccessor::Array::::BEGIN@2Class::XSAccessor::Array::BEGIN@2
1119µs17µsClass::XSAccessor::Array::::BEGIN@62Class::XSAccessor::Array::BEGIN@62
1119µs46µsClass::XSAccessor::Array::::BEGIN@5Class::XSAccessor::Array::BEGIN@5
1119µs18µsClass::XSAccessor::Array::::BEGIN@3Class::XSAccessor::Array::BEGIN@3
2118µs8µsClass::XSAccessor::Array::::newxs_constructorClass::XSAccessor::Array::newxs_constructor (xsub)
1117µs10µsClass::XSAccessor::Array::::BEGIN@4Class::XSAccessor::Array::BEGIN@4
1115µs5µsClass::XSAccessor::Array::::BEGIN@7Class::XSAccessor::Array::BEGIN@7
7114µs4µ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;
2237µs116µs
# spent 16µs within Class::XSAccessor::Array::BEGIN@2 which was called: # once (16µs+0s) by Data::DPath::Step::BEGIN@14 at line 2
use 5.008;
# spent 16µs making 1 call to Class::XSAccessor::Array::BEGIN@2
3220µs228µs
# spent 18µs (9+9) within Class::XSAccessor::Array::BEGIN@3 which was called: # once (9µs+9µs) by Data::DPath::Step::BEGIN@14 at line 3
use strict;
# spent 18µs making 1 call to Class::XSAccessor::Array::BEGIN@3 # spent 10µs making 1 call to strict::import
4220µs213µs
# spent 10µs (7+3) within Class::XSAccessor::Array::BEGIN@4 which was called: # once (7µs+3µs) by Data::DPath::Step::BEGIN@14 at line 4
use warnings;
# spent 10µs making 1 call to Class::XSAccessor::Array::BEGIN@4 # spent 3µs making 1 call to warnings::import
5220µs283µs
# spent 46µs (9+37) within Class::XSAccessor::Array::BEGIN@5 which was called: # once (9µs+37µs) by Data::DPath::Step::BEGIN@14 at line 5
use Carp qw/croak/;
# spent 46µs making 1 call to Class::XSAccessor::Array::BEGIN@5 # spent 37µs making 1 call to Exporter::import
6270µs21.28ms
# spent 1.24ms (535µs+706µs) within Class::XSAccessor::Array::BEGIN@6 which was called: # once (535µs+706µs) by Data::DPath::Step::BEGIN@14 at line 6
use Class::XSAccessor;
# spent 1.24ms making 1 call to Class::XSAccessor::Array::BEGIN@6 # spent 41µs making 1 call to Class::XSAccessor::import
72258µs15µs
# spent 5µs within Class::XSAccessor::Array::BEGIN@7 which was called: # once (5µs+0s) by Data::DPath::Step::BEGIN@14 at line 7
use Class::XSAccessor::Heavy;
# spent 5µs making 1 call to Class::XSAccessor::Array::BEGIN@7
8
91400nsour $VERSION = '1.14';
10
11
# spent 299µs (87+212) within Class::XSAccessor::Array::import which was called 2 times, avg 150µs/call: # once (55µs+114µs) by Data::DPath::Context::BEGIN@57 at line 57 of Data/DPath/Context.pm # once (32µs+98µs) by Data::DPath::Step::BEGIN@14 at line 14 of Data/DPath/Step.pm
sub import {
1221µs my $own_class = shift;
1323µs my ($caller_pkg) = caller();
14
15 # Support both { getters => ... } and plain getters => ...
1625µs my %opts = ref($_[0]) eq 'HASH' ? %{$_[0]} : @_;
17
182900ns $caller_pkg = $opts{class} if defined $opts{class};
19
2022µs my $read_subs = $opts{getters} || {};
212800ns my $set_subs = $opts{setters} || {};
222900ns my $acc_subs = $opts{accessors} || {};
232800ns my $lvacc_subs = $opts{lvalue_accessors} || {};
242900ns my $pred_subs = $opts{predicates} || {};
2523µs my $construct_subs = $opts{constructors} || [defined($opts{constructor}) ? $opts{constructor} : ()];
262700ns my $true_subs = $opts{true} || [];
2721µs my $false_subs = $opts{false} || [];
28
29
3027µ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];
371015µs foreach my $subname (keys %$subs) {
3852µs my $array_index = $subs->{$subname};
39512µs5162µs _generate_method($caller_pkg, $subname, $array_index, \%opts, $subtype->[0]);
# spent 162µs making 5 calls to Class::XSAccessor::Array::_generate_method, avg 32µs/call
40 }
41 }
42
43216µs foreach my $subtype ( ["constructor", $construct_subs],
44 ["true", $true_subs],
45 ["false", $false_subs] )
46 {
4765µs foreach my $subname (@{$subtype->[1]}) {
4825µs250µs _generate_method($caller_pkg, $subname, "", \%opts, $subtype->[0]);
# spent 50µs making 2 calls to Class::XSAccessor::Array::_generate_method, avg 25µs/call
49 }
50 }
51}
52
53
# spent 212µs (90+122) within Class::XSAccessor::Array::_generate_method which was called 7 times, avg 30µs/call: # 5 times (68µs+94µs) by Class::XSAccessor::Array::import at line 39, avg 32µs/call # 2 times (22µs+28µs) by Class::XSAccessor::Array::import at line 48, avg 25µs/call
sub _generate_method {
5476µs my ($caller_pkg, $subname, $array_index, $opts, $type) = @_;
55
5671µs croak("Cannot use undef as a array index for generating an XS $type accessor. (Sub: $subname)")
57 if not defined $array_index;
58
59728µs74µs $subname = "${caller_pkg}::$subname" if $subname !~ /::/;
# spent 4µs making 7 calls to Class::XSAccessor::Array::CORE:match, avg 629ns/call
60
61711µs782µs Class::XSAccessor::Heavy::check_sub_existence($subname) if not $opts->{replace};
# spent 82µs making 7 calls to Class::XSAccessor::Heavy::check_sub_existence, avg 12µs/call
62295µs225µs
# spent 17µs (9+8) within Class::XSAccessor::Array::BEGIN@62 which was called: # once (9µs+8µs) by Data::DPath::Step::BEGIN@14 at line 62
no warnings 'redefine'; # don't warn about an explicitly requested redefine
# spent 17µs making 1 call to Class::XSAccessor::Array::BEGIN@62 # spent 8µs making 1 call to warnings::unimport
63
6472µs if ($type eq 'getter') {
65 newxs_getter($subname, $array_index);
66 }
67735µ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 {
86544µs528µs newxs_accessor($subname, $array_index, $opts->{chained}||0);
# spent 28µs making 5 calls to Class::XSAccessor::Array::newxs_accessor, avg 6µs/call
87 }
88}
89
9012µs1;
91
92__END__
 
# spent 4µs within Class::XSAccessor::Array::CORE:match which was called 7 times, avg 629ns/call: # 7 times (4µs+0s) by Class::XSAccessor::Array::_generate_method at line 59, avg 629ns/call
sub Class::XSAccessor::Array::CORE:match; # opcode
# spent 28µs within Class::XSAccessor::Array::newxs_accessor which was called 5 times, avg 6µs/call: # 5 times (28µ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