← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:33:55 2022
Reported on Wed Dec 14 15:40:04 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Data/Perl/Collection/Hash/MooseLike.pm
StatementsExecuted 303531 statements in 572ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
7588011528ms6.61sData::Perl::Collection::Hash::MooseLike::::__ANON__[:22]Data::Perl::Collection::Hash::MooseLike::__ANON__[:22]
11145µs159µsData::Perl::Collection::Hash::MooseLike::::BEGIN@5Data::Perl::Collection::Hash::MooseLike::BEGIN@5
1118µs38µsData::Perl::Collection::Hash::MooseLike::::BEGIN@7Data::Perl::Collection::Hash::MooseLike::BEGIN@7
1116µs33µsData::Perl::Collection::Hash::MooseLike::::BEGIN@8Data::Perl::Collection::Hash::MooseLike::BEGIN@8
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Data::Perl::Collection::Hash::MooseLike;
210s$Data::Perl::Collection::Hash::MooseLike::VERSION = '0.001009';
3# ABSTRACT: Collection::Hash subclass that simulates Moose's native traits.
4
5335µs3272µs
# spent 159µs (45+114) within Data::Perl::Collection::Hash::MooseLike::BEGIN@5 which was called: # once (45µs+114µs) by Module::Runtime::require_module at line 5
use strictures 1;
# spent 159µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@5 # spent 86µs making 1 call to strictures::import # spent 27µs making 1 call to strictures::VERSION
6
7232µs268µs
# spent 38µs (8+30) within Data::Perl::Collection::Hash::MooseLike::BEGIN@7 which was called: # once (8µs+30µs) by Module::Runtime::require_module at line 7
use Role::Tiny::With;
# spent 38µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@7 # spent 30µs making 1 call to Exporter::import
82187µs260µs
# spent 33µs (6+27) within Data::Perl::Collection::Hash::MooseLike::BEGIN@8 which was called: # once (6µs+27µs) by Module::Runtime::require_module at line 8
use Class::Method::Modifiers;
# spent 33µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@8 # spent 27µs making 1 call to Exporter::import
9
1012µs12.13mswith 'Data::Perl::Role::Collection::Hash';
# spent 2.13ms making 1 call to Role::Tiny::With::with
11
12
# spent 6.61s (528ms+6.08) within Data::Perl::Collection::Hash::MooseLike::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Data/Perl/Collection/Hash/MooseLike.pm:22] which was called 75880 times, avg 87µs/call: # 75880 times (528ms+6.08s) by Data::Perl::Collection::Hash::MooseLike::__ANON__[(eval 280)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Class/Method/Modifiers.pm:89]:1] or Data::Perl::Collection::Hash::MooseLike::__ANON__[(eval 284)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Class/Method/Modifiers.pm:89]:1] at line 1 of (eval 280)[Class/Method/Modifiers.pm:89], avg 87µs/call
around 'set', 'get', 'delete' => sub {
137588019.6ms my $orig = shift;
1475880108ms758806.03s my @res = $orig->(@_);
# spent 6.02s making 75815 calls to Data::Perl::Role::Collection::Hash::get, avg 79µs/call # spent 7.48ms making 65 calls to Data::Perl::Role::Collection::Hash::set, avg 115µs/call
15
16 # support both class instance method invocation style
1775880284ms7588054.9ms @res = blessed($res[0])
# spent 54.9ms making 75880 calls to Scalar::Util::blessed, avg 724ns/call
18 && ($res[0]->isa('Data::Perl::Collection::Hash')
19 || $res[0]->isa('Data::Perl::Collection::Array')) ? $res[0]->flatten : @res;
20
2175880161ms wantarray ? @res : $res[-1];
22112µs1647µs};
# spent 647µs making 1 call to Class::Method::Modifiers::around
23
2419µs1;
25
26=pod
27
28=encoding UTF-8
29
30=head1 NAME
31
32Data::Perl::Collection::Hash::MooseLike - Collection::Hash subclass that simulates Moose's native traits.
33
34=head1 VERSION
35
36version 0.001009
37
38=head1 SYNOPSIS
39
40 use Data::Perl::Collection::Hash::MooseLike;
41
42 my $hash = Data::Perl::Collection::Hash::MooseLike->new(a => 1, b => 2);
43
44 $hash->values; # (1, 2)
45
46 $hash->set('foo', 'bar'); # (a => 1, b => 2, foo => 'bar')
47
48=head1 DESCRIPTION
49
50This class provides a wrapper and methods for interacting with a hash. All
51methods are written to emulate/match existing behavior that exists with Moose's
52native traits.
53
54=head1 DIFFERENCES IN FUNCTIONALITY
55
56=over 4
57
58=item B<get($key, $key, ...)>
59
60Returns values from the hash.
61
62In list context it returns a list of values in the hash for the given keys. In
63scalar context it returns the value for the last key specified.
64
65=item B<set($key, $value, ...)>
66
67Sets the elements in the hash to the given values. It returns the new values
68set for each key, in the same order as the keys passed to the method.
69
70This method requires at least two arguments, and expects an even number of
71arguments.
72
73=item B<delete($key, $key, ...)>
74
75Removes the elements with the given keys.
76
77In list context it returns a list of values in the hash for the deleted keys.
78In scalar context it returns the value for the last key specified.
79
80=back
81
82=head1 SEE ALSO
83
84=over 4
85
86=item * L<Data::Perl>
87
88=item * L<Data::Perl::Role::Collection::Hash>
89
90=back
91
92=head1 AUTHOR
93
94Toby Inkster <tobyink@cpan.org>
95
96=head1 COPYRIGHT AND LICENSE
97
98This software is copyright (c) 2020 by Matthew Phillips <mattp@cpan.org>.
99
100This is free software; you can redistribute it and/or modify it under
101the same terms as the Perl 5 programming language system itself.
102
103=cut
104
105__END__