← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 16:10:05 2022
Reported on Wed Dec 14 16:12:58 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Data/Perl/Collection/Hash/MooseLike.pm
StatementsExecuted 294863 statements in 614ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
7371311545ms7.64sData::Perl::Collection::Hash::MooseLike::::__ANON__[:22]Data::Perl::Collection::Hash::MooseLike::__ANON__[:22]
11150µs173µsData::Perl::Collection::Hash::MooseLike::::BEGIN@5Data::Perl::Collection::Hash::MooseLike::BEGIN@5
11110µs43µsData::Perl::Collection::Hash::MooseLike::::BEGIN@7Data::Perl::Collection::Hash::MooseLike::BEGIN@7
1116µs42µ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
5346µs3296µs
# spent 173µs (50+123) within Data::Perl::Collection::Hash::MooseLike::BEGIN@5 which was called: # once (50µs+123µs) by Module::Runtime::require_module at line 5
use strictures 1;
# spent 173µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@5 # spent 94µs making 1 call to strictures::import # spent 29µs making 1 call to strictures::VERSION
6
7236µs276µs
# spent 43µs (10+33) within Data::Perl::Collection::Hash::MooseLike::BEGIN@7 which was called: # once (10µs+33µs) by Module::Runtime::require_module at line 7
use Role::Tiny::With;
# spent 43µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@7 # spent 33µs making 1 call to Exporter::import
82224µs278µs
# spent 42µs (6+36) within Data::Perl::Collection::Hash::MooseLike::BEGIN@8 which was called: # once (6µs+36µs) by Module::Runtime::require_module at line 8
use Class::Method::Modifiers;
# spent 42µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@8 # spent 36µs making 1 call to Exporter::import
9
1011µs11.83mswith 'Data::Perl::Role::Collection::Hash';
# spent 1.83ms making 1 call to Role::Tiny::With::with
11
12
# spent 7.64s (545ms+7.10) 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 73713 times, avg 104µs/call: # 73713 times (545ms+7.10s) by Data::Perl::Collection::Hash::MooseLike::__ANON__[(eval 284)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Class/Method/Modifiers.pm:89]:1] or Data::Perl::Collection::Hash::MooseLike::__ANON__[(eval 288)[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Class/Method/Modifiers.pm:89]:1] at line 1 of (eval 284)[Class/Method/Modifiers.pm:89], avg 104µs/call
around 'set', 'get', 'delete' => sub {
137371322.9ms my $orig = shift;
1473713117ms737137.03s my @res = $orig->(@_);
# spent 7.02s making 73648 calls to Data::Perl::Role::Collection::Hash::get, avg 95µs/call # spent 9.14ms making 65 calls to Data::Perl::Role::Collection::Hash::set, avg 141µs/call
15
16 # support both class instance method invocation style
1773713270ms7371366.2ms @res = blessed($res[0])
# spent 66.2ms making 73713 calls to Scalar::Util::blessed, avg 897ns/call
18 && ($res[0]->isa('Data::Perl::Collection::Hash')
19 || $res[0]->isa('Data::Perl::Collection::Array')) ? $res[0]->flatten : @res;
20
2173713204ms wantarray ? @res : $res[-1];
2213µs1742µs};
# spent 742µs making 1 call to Class::Method::Modifiers::around
23
2418µ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__