← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Thu Dec 15 15:23:56 2022
Reported on Thu Dec 15 15:27:03 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Data/Perl/Collection/Hash/MooseLike.pm
StatementsExecuted 300563 statements in 467ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
7513811403ms6.03sData::Perl::Collection::Hash::MooseLike::::__ANON__[:22]Data::Perl::Collection::Hash::MooseLike::__ANON__[:22]
11135µs153µsData::Perl::Collection::Hash::MooseLike::::BEGIN@5Data::Perl::Collection::Hash::MooseLike::BEGIN@5
1116µs22µsData::Perl::Collection::Hash::MooseLike::::BEGIN@8Data::Perl::Collection::Hash::MooseLike::BEGIN@8
1114µs30µsData::Perl::Collection::Hash::MooseLike::::BEGIN@7Data::Perl::Collection::Hash::MooseLike::BEGIN@7
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;
211µs$Data::Perl::Collection::Hash::MooseLike::VERSION = '0.001009';
3# ABSTRACT: Collection::Hash subclass that simulates Moose's native traits.
4
5325µs3271µs
# spent 153µs (35+118) within Data::Perl::Collection::Hash::MooseLike::BEGIN@5 which was called: # once (35µs+118µs) by Module::Runtime::require_module at line 5
use strictures 1;
# spent 153µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@5 # spent 96µs making 1 call to strictures::import # spent 22µs making 1 call to strictures::VERSION
6
7216µs256µs
# spent 30µs (4+26) within Data::Perl::Collection::Hash::MooseLike::BEGIN@7 which was called: # once (4µs+26µs) by Module::Runtime::require_module at line 7
use Role::Tiny::With;
# spent 30µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@7 # spent 26µs making 1 call to Exporter::import
82284µs238µs
# spent 22µs (6+16) within Data::Perl::Collection::Hash::MooseLike::BEGIN@8 which was called: # once (6µs+16µs) by Module::Runtime::require_module at line 8
use Class::Method::Modifiers;
# spent 22µs making 1 call to Data::Perl::Collection::Hash::MooseLike::BEGIN@8 # spent 16µs making 1 call to Exporter::import
9
1012µs11.86mswith 'Data::Perl::Role::Collection::Hash';
# spent 1.86ms making 1 call to Role::Tiny::With::with
11
12
# spent 6.03s (403ms+5.63) 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 75138 times, avg 80µs/call: # 75138 times (403ms+5.63s) 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 80µs/call
around 'set', 'get', 'delete' => sub {
137513812.0ms my $orig = shift;
147513876.6ms751385.57s my @res = $orig->(@_);
# spent 5.56s making 75073 calls to Data::Perl::Role::Collection::Hash::get, avg 74µs/call # spent 7.47ms making 65 calls to Data::Perl::Role::Collection::Hash::set, avg 115µs/call
15
16 # support both class instance method invocation style
1775138215ms7513857.0ms @res = blessed($res[0])
# spent 57.0ms making 75138 calls to Scalar::Util::blessed, avg 759ns/call
18 && ($res[0]->isa('Data::Perl::Collection::Hash')
19 || $res[0]->isa('Data::Perl::Collection::Array')) ? $res[0]->flatten : @res;
20
2175138163ms wantarray ? @res : $res[-1];
2214µs1335µs};
# spent 335µs making 1 call to Class::Method::Modifiers::around
23
2414µ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__