Filename | /usr/lib/x86_64-linux-gnu/perl5/5.20/Class/XSAccessor.pm |
Statements | Executed 2053 statements in 4.55ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
30 | 2 | 2 | 1.42ms | 2.19ms | import | Class::XSAccessor::
1 | 1 | 1 | 672µs | 872µs | BEGIN@6 | Class::XSAccessor::
30 | 1 | 1 | 282µs | 541µs | _generate_method | Class::XSAccessor::
240 | 8 | 1 | 231µs | 231µs | _make_hash | Class::XSAccessor::
26 | 1 | 1 | 205µs | 205µs | newxs_accessor (xsub) | Class::XSAccessor::
30 | 1 | 1 | 35µs | 35µs | CORE:match (opcode) | Class::XSAccessor::
1 | 1 | 1 | 34µs | 34µs | BEGIN@2 | Class::XSAccessor::
1 | 1 | 1 | 30µs | 63µs | BEGIN@84 | Class::XSAccessor::
1 | 1 | 1 | 21µs | 37µs | BEGIN@3 | Class::XSAccessor::
4 | 1 | 1 | 19µs | 19µs | newxs_getter (xsub) | Class::XSAccessor::
1 | 1 | 1 | 13µs | 56µs | BEGIN@5 | Class::XSAccessor::
1 | 1 | 1 | 12µs | 24µs | BEGIN@4 | Class::XSAccessor::
1 | 1 | 1 | 11µs | 11µs | BEGIN@7 | Class::XSAccessor::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::XSAccessor; | ||||
2 | 2 | 74µs | 1 | 34µs | # spent 34µs within Class::XSAccessor::BEGIN@2 which was called:
# once (34µs+0s) by Module::Runtime::require_module at line 2 # spent 34µs making 1 call to Class::XSAccessor::BEGIN@2 |
3 | 2 | 63µs | 2 | 53µs | # spent 37µs (21+16) within Class::XSAccessor::BEGIN@3 which was called:
# once (21µs+16µs) by Module::Runtime::require_module at line 3 # spent 37µs making 1 call to Class::XSAccessor::BEGIN@3
# spent 16µs making 1 call to strict::import |
4 | 2 | 56µs | 2 | 37µs | # spent 24µs (12+13) within Class::XSAccessor::BEGIN@4 which was called:
# once (12µs+13µs) by Module::Runtime::require_module at line 4 # spent 24µs making 1 call to Class::XSAccessor::BEGIN@4
# spent 13µs making 1 call to warnings::import |
5 | 2 | 91µs | 2 | 98µs | # spent 56µs (13+42) within Class::XSAccessor::BEGIN@5 which was called:
# once (13µs+42µs) by Module::Runtime::require_module at line 5 # spent 56µs making 1 call to Class::XSAccessor::BEGIN@5
# spent 42µs making 1 call to Exporter::import |
6 | 2 | 248µs | 1 | 872µs | # spent 872µs (672+200) within Class::XSAccessor::BEGIN@6 which was called:
# once (672µs+200µs) by Module::Runtime::require_module at line 6 # spent 872µs making 1 call to Class::XSAccessor::BEGIN@6 |
7 | 2 | 825µs | 1 | 11µs | # spent 11µs within Class::XSAccessor::BEGIN@7 which was called:
# once (11µs+0s) by Module::Runtime::require_module at line 7 # spent 11µs making 1 call to Class::XSAccessor::BEGIN@7 |
8 | |||||
9 | 1 | 1µs | our $VERSION = '1.19'; | ||
10 | |||||
11 | 1 | 534µs | 1 | 512µs | XSLoader::load('Class::XSAccessor', $VERSION); # spent 512µs making 1 call to XSLoader::load |
12 | |||||
13 | # spent 231µs within Class::XSAccessor::_make_hash which was called 240 times, avg 963ns/call:
# 30 times (60µs+0s) by Class::XSAccessor::import at line 37, avg 2µs/call
# 30 times (28µs+0s) by Class::XSAccessor::import at line 38, avg 937ns/call
# 30 times (27µs+0s) by Class::XSAccessor::import at line 40, avg 897ns/call
# 30 times (25µs+0s) by Class::XSAccessor::import at line 41, avg 830ns/call
# 30 times (24µs+0s) by Class::XSAccessor::import at line 39, avg 813ns/call
# 30 times (23µs+0s) by Class::XSAccessor::import at line 44, avg 760ns/call
# 30 times (22µs+0s) by Class::XSAccessor::import at line 42, avg 740ns/call
# 30 times (22µs+0s) by Class::XSAccessor::import at line 43, avg 730ns/call | ||||
14 | 240 | 31µs | my $ref = shift; | ||
15 | |||||
16 | 240 | 66µs | if (ref ($ref)) { | ||
17 | if (ref($ref) eq 'ARRAY') { | ||||
18 | $ref = { map { $_ => $_ } @$ref } | ||||
19 | } | ||||
20 | } else { | ||||
21 | $ref = { $ref, $ref }; | ||||
22 | } | ||||
23 | |||||
24 | 240 | 349µs | return $ref; | ||
25 | } | ||||
26 | |||||
27 | # spent 2.19ms (1.42+772µs) within Class::XSAccessor::import which was called 30 times, avg 73µs/call:
# 26 times (1.26ms+684µs) by DBIx::Class::ResultSet::_result_class or DBIx::Class::ResultSet::result_source or DBIx::Class::ResultSource::_columns or DBIx::Class::ResultSource::_ordered_columns or DBIx::Class::ResultSource::_primaries or DBIx::Class::ResultSource::_relationships or DBIx::Class::ResultSource::_unique_constraints or DBIx::Class::ResultSource::name or DBIx::Class::ResultSource::source_name or DBIx::Class::Row::in_storage or DBIx::Class::Storage::DBI::_conn_pid or DBIx::Class::Storage::DBI::_connect_info or DBIx::Class::Storage::DBI::_dbh or DBIx::Class::Storage::DBI::_dbh_autocommit or DBIx::Class::Storage::DBI::_dbh_details or DBIx::Class::Storage::DBI::_dbic_connect_attributes or DBIx::Class::Storage::DBI::_driver_determined or DBIx::Class::Storage::DBI::_sql_maker or DBIx::Class::Storage::DBI::_sql_maker_opts or DBIx::Class::Storage::DBI::disable_sth_caching or DBIx::Class::Storage::DBI::on_connect_call or DBIx::Class::Storage::DBI::on_connect_do or DBIx::Class::Storage::DBI::unsafe or DBIx::Class::Storage::debug or DBIx::Class::Storage::schema or DBIx::Class::Storage::transaction_depth at line 830 of Class/Accessor/Grouped.pm, avg 75µs/call
# 4 times (164µs+87µs) by Method::Generate::Accessor::_generate_xs at line 641 of Method/Generate/Accessor.pm, avg 63µs/call | ||||
28 | 30 | 11µs | my $own_class = shift; | ||
29 | 30 | 37µs | my ($caller_pkg) = caller(); | ||
30 | |||||
31 | # Support both { getters => ... } and plain getters => ... | ||||
32 | 30 | 68µs | my %opts = ref($_[0]) eq 'HASH' ? %{$_[0]} : @_; | ||
33 | |||||
34 | 30 | 21µs | $caller_pkg = $opts{class} if defined $opts{class}; | ||
35 | |||||
36 | # TODO: Refactor. Move more duplicated code to ::Heavy | ||||
37 | 30 | 50µs | 30 | 60µs | my $read_subs = _make_hash($opts{getters} || {}); # spent 60µs making 30 calls to Class::XSAccessor::_make_hash, avg 2µs/call |
38 | 30 | 35µs | 30 | 28µs | my $set_subs = _make_hash($opts{setters} || {}); # spent 28µs making 30 calls to Class::XSAccessor::_make_hash, avg 937ns/call |
39 | 30 | 27µs | 30 | 24µs | my $acc_subs = _make_hash($opts{accessors} || {}); # spent 24µs making 30 calls to Class::XSAccessor::_make_hash, avg 813ns/call |
40 | 30 | 30µs | 30 | 27µs | my $lvacc_subs = _make_hash($opts{lvalue_accessors} || {}); # spent 27µs making 30 calls to Class::XSAccessor::_make_hash, avg 897ns/call |
41 | 30 | 31µs | 30 | 25µs | my $pred_subs = _make_hash($opts{predicates} || {}); # spent 25µs making 30 calls to Class::XSAccessor::_make_hash, avg 830ns/call |
42 | 30 | 28µs | 30 | 22µs | my $ex_pred_subs = _make_hash($opts{exists_predicates} || {}); # spent 22µs making 30 calls to Class::XSAccessor::_make_hash, avg 740ns/call |
43 | 30 | 26µs | 30 | 22µs | my $def_pred_subs = _make_hash($opts{defined_predicates} || {}); # spent 22µs making 30 calls to Class::XSAccessor::_make_hash, avg 730ns/call |
44 | 30 | 28µs | 30 | 23µs | my $test_subs = _make_hash($opts{__tests__} || {}); # spent 23µs making 30 calls to Class::XSAccessor::_make_hash, avg 760ns/call |
45 | 30 | 25µs | my $construct_subs = $opts{constructors} || [defined($opts{constructor}) ? $opts{constructor} : ()]; | ||
46 | 30 | 13µs | my $true_subs = $opts{true} || []; | ||
47 | 30 | 13µs | my $false_subs = $opts{false} || []; | ||
48 | |||||
49 | 30 | 119µs | foreach my $subtype ( ["getter", $read_subs], | ||
50 | ["setter", $set_subs], | ||||
51 | ["accessor", $acc_subs], | ||||
52 | ["lvalue_accessor", $lvacc_subs], | ||||
53 | ["test", $test_subs], | ||||
54 | ["ex_predicate", $ex_pred_subs], | ||||
55 | ["def_predicate", $def_pred_subs], | ||||
56 | ["def_predicate", $pred_subs] ) | ||||
57 | { | ||||
58 | 240 | 60µs | my $subs = $subtype->[1]; | ||
59 | 240 | 289µs | foreach my $subname (keys %$subs) { | ||
60 | 30 | 18µs | my $hashkey = $subs->{$subname}; | ||
61 | 30 | 98µs | 30 | 541µs | _generate_method($caller_pkg, $subname, $hashkey, \%opts, $subtype->[0]); # spent 541µs making 30 calls to Class::XSAccessor::_generate_method, avg 18µs/call |
62 | } | ||||
63 | } | ||||
64 | |||||
65 | 30 | 200µs | foreach my $subtype ( ["constructor", $construct_subs], | ||
66 | ["true", $true_subs], | ||||
67 | ["false", $false_subs] ) | ||||
68 | { | ||||
69 | 90 | 50µs | foreach my $subname (@{$subtype->[1]}) { | ||
70 | _generate_method($caller_pkg, $subname, "", \%opts, $subtype->[0]); | ||||
71 | } | ||||
72 | } | ||||
73 | } | ||||
74 | |||||
75 | # spent 541µs (282+259) within Class::XSAccessor::_generate_method which was called 30 times, avg 18µs/call:
# 30 times (282µs+259µs) by Class::XSAccessor::import at line 61, avg 18µs/call | ||||
76 | 30 | 21µs | my ($caller_pkg, $subname, $hashkey, $opts, $type) = @_; | ||
77 | |||||
78 | 30 | 9µs | croak("Cannot use undef as a hash key for generating an XS $type accessor. (Sub: $subname)") | ||
79 | if not defined $hashkey; | ||||
80 | |||||
81 | 30 | 126µs | 30 | 35µs | $subname = "${caller_pkg}::$subname" if $subname !~ /::/; # spent 35µs making 30 calls to Class::XSAccessor::CORE:match, avg 1µs/call |
82 | |||||
83 | 30 | 11µs | Class::XSAccessor::Heavy::check_sub_existence($subname) if not $opts->{replace}; | ||
84 | 2 | 370µs | 2 | 96µs | # spent 63µs (30+33) within Class::XSAccessor::BEGIN@84 which was called:
# once (30µs+33µs) by Module::Runtime::require_module at line 84 # spent 63µs making 1 call to Class::XSAccessor::BEGIN@84
# spent 33µs making 1 call to warnings::unimport |
85 | |||||
86 | 30 | 114µs | 4 | 19µs | if ($type eq 'getter') { # spent 19µs making 4 calls to Class::XSAccessor::newxs_getter, avg 5µs/call |
87 | newxs_getter($subname, $hashkey); | ||||
88 | } | ||||
89 | elsif ($type eq 'lvalue_accessor') { | ||||
90 | newxs_lvalue_accessor($subname, $hashkey); | ||||
91 | } | ||||
92 | elsif ($type eq 'setter') { | ||||
93 | newxs_setter($subname, $hashkey, $opts->{chained}||0); | ||||
94 | } | ||||
95 | elsif ($type eq 'def_predicate') { | ||||
96 | newxs_defined_predicate($subname, $hashkey); | ||||
97 | } | ||||
98 | elsif ($type eq 'ex_predicate') { | ||||
99 | newxs_exists_predicate($subname, $hashkey); | ||||
100 | } | ||||
101 | elsif ($type eq 'constructor') { | ||||
102 | newxs_constructor($subname); | ||||
103 | } | ||||
104 | elsif ($type eq 'true') { | ||||
105 | newxs_boolean($subname, 1); | ||||
106 | } | ||||
107 | elsif ($type eq 'false') { | ||||
108 | newxs_boolean($subname, 0); | ||||
109 | } | ||||
110 | elsif ($type eq 'test') { | ||||
111 | newxs_test($subname, $hashkey); | ||||
112 | } | ||||
113 | else { | ||||
114 | 26 | 268µs | 26 | 205µs | newxs_accessor($subname, $hashkey, $opts->{chained}||0); # spent 205µs making 26 calls to Class::XSAccessor::newxs_accessor, avg 8µs/call |
115 | } | ||||
116 | } | ||||
117 | |||||
118 | 1 | 12µs | 1; | ||
119 | |||||
120 | __END__ | ||||
# spent 35µs within Class::XSAccessor::CORE:match which was called 30 times, avg 1µs/call:
# 30 times (35µs+0s) by Class::XSAccessor::_generate_method at line 81, avg 1µs/call | |||||
# spent 205µs within Class::XSAccessor::newxs_accessor which was called 26 times, avg 8µs/call:
# 26 times (205µs+0s) by Class::XSAccessor::_generate_method at line 114, avg 8µs/call | |||||
# spent 19µs within Class::XSAccessor::newxs_getter which was called 4 times, avg 5µs/call:
# 4 times (19µs+0s) by Class::XSAccessor::_generate_method at line 86, avg 5µs/call |