Filename | /Users/edenc/perl5/lib/perl5/KiokuDB/Serializer.pm |
Statements | Executed 14 statements in 405µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 23µs | 2.82ms | BEGIN@4 | KiokuDB::Serializer::
1 | 1 | 1 | 11µs | 47µs | BEGIN@6 | KiokuDB::Serializer::
1 | 1 | 1 | 10µs | 820µs | BEGIN@10 | KiokuDB::Serializer::
1 | 1 | 1 | 10µs | 1.81ms | BEGIN@8 | KiokuDB::Serializer::
0 | 0 | 0 | 0s | 0s | __ANON__[:28] | KiokuDB::Serializer::
0 | 0 | 0 | 0s | 0s | __ANON__[:34] | KiokuDB::Serializer::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | #!/usr/bin/perl | ||||
2 | |||||
3 | package KiokuDB::Serializer; | ||||
4 | 2 | 53µs | 2 | 5.62ms | # spent 2.82ms (23µs+2.80) within KiokuDB::Serializer::BEGIN@4 which was called:
# once (23µs+2.80ms) by KiokuDB::Backend::Serialize::Delegate::BEGIN@6 at line 4 # spent 2.82ms making 1 call to KiokuDB::Serializer::BEGIN@4
# spent 2.80ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:492] |
5 | |||||
6 | 2 | 28µs | 2 | 82µs | # spent 47µs (11+36) within KiokuDB::Serializer::BEGIN@6 which was called:
# once (11µs+36µs) by KiokuDB::Backend::Serialize::Delegate::BEGIN@6 at line 6 # spent 47µs making 1 call to KiokuDB::Serializer::BEGIN@6
# spent 36µs making 1 call to Exporter::import |
7 | |||||
8 | 2 | 45µs | 2 | 3.60ms | # spent 1.81ms (10µs+1.80) within KiokuDB::Serializer::BEGIN@8 which was called:
# once (10µs+1.80ms) by KiokuDB::Backend::Serialize::Delegate::BEGIN@6 at line 8 # spent 1.81ms making 1 call to KiokuDB::Serializer::BEGIN@8
# spent 1.80ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:492] |
9 | |||||
10 | 2 | 229µs | 2 | 1.63ms | # spent 820µs (10+810) within KiokuDB::Serializer::BEGIN@10 which was called:
# once (10µs+810µs) by KiokuDB::Backend::Serialize::Delegate::BEGIN@6 at line 10 # spent 820µs making 1 call to KiokuDB::Serializer::BEGIN@10
# spent 810µs making 1 call to namespace::clean::import |
11 | |||||
12 | 1 | 4µs | 1 | 9.05ms | with qw(KiokuDB::Backend::Serialize); # spent 9.05ms making 1 call to Moose::Role::with |
13 | |||||
14 | 1 | 2µs | 1 | 60µs | requires "serialize_to_stream"; # spent 60µs making 1 call to Moose::Role::requires |
15 | 1 | 1µs | 1 | 43µs | requires "deserialize_from_stream"; # spent 43µs making 1 call to Moose::Role::requires |
16 | |||||
17 | 1 | 2µs | my %types = ( | ||
18 | storable => "KiokuDB::Serializer::Storable", | ||||
19 | json => "KiokuDB::Serializer::JSON", | ||||
20 | yaml => "KiokuDB::Serializer::YAML", | ||||
21 | ); | ||||
22 | |||||
23 | coerce( __PACKAGE__, | ||||
24 | from Str => via { | ||||
25 | my $class = $types{lc($_)} or croak "unknown format: $_";; | ||||
26 | Class::MOP::load_class($class); | ||||
27 | $class->new; | ||||
28 | }, | ||||
29 | from HashRef => via { | ||||
30 | my %args = %$_; | ||||
31 | my $class = $types{lc(delete $args{format})} or croak "unknown format: $args{format}"; | ||||
32 | Class::MOP::load_class($class); | ||||
33 | $class->new(%args); | ||||
34 | }, | ||||
35 | 1 | 12µs | 5 | 316µs | ); # spent 312µs making 1 call to Moose::Util::TypeConstraints::coerce
# spent 3µs making 2 calls to Moose::Util::TypeConstraints::from, avg 1µs/call
# spent 2µs making 2 calls to Moose::Util::TypeConstraints::via, avg 1µs/call |
36 | |||||
37 | 1 | 18µs | __PACKAGE__ | ||
38 | |||||
39 | 1 | 12µs | 1 | 2.10ms | __END__ # spent 2.10ms making 1 call to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:26] |