File | /data/SimpleDB-Class/author.t/../lib/SimpleDB/Class/Types.pm |
Statements Executed | 1088 |
Statement Execution Time | 5.07ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.01ms | 28.6ms | BEGIN@77 | SimpleDB::Class::Types::
571 | 1 | 1 | 973µs | 973µs | __ANON__[../lib/SimpleDB/Class/Types.pm:89] | SimpleDB::Class::Types::
1 | 1 | 1 | 304µs | 6.01ms | BEGIN@83 | SimpleDB::Class::Types::
74 | 1 | 1 | 303µs | 391µs | __ANON__[../lib/SimpleDB/Class/Types.pm:108] | SimpleDB::Class::Types::
126 | 5 | 2 | 236µs | 7.06ms | CORE:match (opcode) | SimpleDB::Class::Types::
16 | 2 | 1 | 189µs | 189µs | slice_string | SimpleDB::Class::Types::
71 | 1 | 1 | 142µs | 142µs | __ANON__[../lib/SimpleDB/Class/Types.pm:93] | SimpleDB::Class::Types::
28 | 1 | 1 | 124µs | 155µs | __ANON__[../lib/SimpleDB/Class/Types.pm:112] | SimpleDB::Class::Types::
7 | 1 | 1 | 101µs | 152µs | mend_string | SimpleDB::Class::Types::
14 | 1 | 1 | 76µs | 76µs | __ANON__[../lib/SimpleDB/Class/Types.pm:159] | SimpleDB::Class::Types::
8 | 1 | 1 | 72µs | 544µs | __ANON__[../lib/SimpleDB/Class/Types.pm:165] | SimpleDB::Class::Types::
9 | 1 | 1 | 69µs | 6.95ms | __ANON__[../lib/SimpleDB/Class/Types.pm:205] | SimpleDB::Class::Types::
5 | 1 | 1 | 51µs | 1.25ms | __ANON__[../lib/SimpleDB/Class/Types.pm:221] | SimpleDB::Class::Types::
8 | 1 | 1 | 45µs | 1.68ms | __ANON__[../lib/SimpleDB/Class/Types.pm:152] | SimpleDB::Class::Types::
8 | 1 | 1 | 42µs | 86µs | __ANON__[../lib/SimpleDB/Class/Types.pm:163] | SimpleDB::Class::Types::
5 | 1 | 1 | 41µs | 28.2ms | __ANON__[../lib/SimpleDB/Class/Types.pm:185] | SimpleDB::Class::Types::
20 | 1 | 1 | 33µs | 33µs | __ANON__[../lib/SimpleDB/Class/Types.pm:155] | SimpleDB::Class::Types::
7 | 1 | 1 | 32µs | 184µs | __ANON__[../lib/SimpleDB/Class/Types.pm:170] | SimpleDB::Class::Types::
1 | 1 | 1 | 31µs | 41µs | BEGIN@70 | SimpleDB::Class::Types::
5 | 1 | 1 | 26µs | 28.8ms | __ANON__[../lib/SimpleDB/Class/Types.pm:186] | SimpleDB::Class::Types::
5 | 1 | 1 | 23µs | 648µs | __ANON__[../lib/SimpleDB/Class/Types.pm:206] | SimpleDB::Class::Types::
1 | 1 | 1 | 10µs | 40µs | BEGIN@73 | SimpleDB::Class::Types::
7 | 1 | 2 | 10µs | 10µs | CORE:sort (opcode) | SimpleDB::Class::Types::
1 | 1 | 1 | 8µs | 142µs | BEGIN@74 | SimpleDB::Class::Types::
1 | 1 | 1 | 7µs | 10µs | BEGIN@71 | SimpleDB::Class::Types::
1 | 1 | 1 | 6µs | 6µs | BEGIN@72 | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:153] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:154] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:156] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:162] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:164] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:166] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:169] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:171] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:174] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:175] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:187] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:188] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:191] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:192] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:195] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:207] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:208] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:211] | SimpleDB::Class::Types::
0 | 0 | 0 | 0s | 0s | __ANON__[../lib/SimpleDB/Class/Types.pm:222] | SimpleDB::Class::Types::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package SimpleDB::Class::Types; | ||||
2 | |||||
3 | =head1 NAME | ||||
4 | |||||
5 | SimpleDB::Class::Types - Attribute types. | ||||
6 | |||||
7 | =head1 DESCRIPTION | ||||
8 | |||||
9 | The allowable value types for L<SimpleDB::Class::Item> attributes. | ||||
10 | |||||
11 | =head1 SYNOPSIS | ||||
12 | |||||
13 | Type | Default | Range | ||||
14 | -----------------------+----------------+----------------------------------------------- | ||||
15 | Str | '' | 0 to 1024 characters | ||||
16 | MediumStr | '' | 0 to 259,080 chracters | ||||
17 | ArrayRefOfStr | [] | 254 Str elements | ||||
18 | Int | 0 | -999,999,999 to 99,999,999,999,999 (no commas) | ||||
19 | ArrayRefOfInt | [] | 254 Int elements | ||||
20 | DateTime | now() | Any DateTime object | ||||
21 | ArrayRefOfDateTime | [] | 254 DateTime elements | ||||
22 | HashRef | {} | Less than 259,080 characters when converted to JSON | ||||
23 | |||||
24 | =head1 TYPES | ||||
25 | |||||
26 | The following types may be used to define attributes in L<SimpleDB::Class::Item>s. | ||||
27 | |||||
28 | =head2 Str | ||||
29 | |||||
30 | A string of less than 1024 characters. Defaults to C<''>. The basic working unit of SimpleDB. This is the fastest type as it needs no coercion, and is the native storage unit for SimpleDB. When in dobut, use this. | ||||
31 | |||||
32 | =head2 ArrayRefOfStr | ||||
33 | |||||
34 | An array reference of strings which can have up to 254 elements. Each string follows the rules of C<Str>. This is your basic multi-value workhorse, as it is the fastest multi-value type. See B<Attribute Limits> for special considerations about this type. | ||||
35 | |||||
36 | =head2 MediumStr | ||||
37 | |||||
38 | A string of up to 259,080 characters. Defaults to C<''>. Use this B<only> if you need to store text larger than C<Str> will allow. Much slower than C<Str> and not reliably searchable or sortable. See B<Attribute Limits> for special considerations about this type. | ||||
39 | |||||
40 | =head2 Int | ||||
41 | |||||
42 | An integer between -999,999,999 and 99,999,999,999,999 (without the commas). Defaults to C<0>. Is completely searchable and sortable. | ||||
43 | |||||
44 | =head2 ArrayRefOfInt | ||||
45 | |||||
46 | An array reference of integers which can have up to 254 elements. Each integer follows the rules of C<Int>. If you need a multi-value integer type, this is the way to go. See B<Attribute Limits> for special considerations about this type. | ||||
47 | |||||
48 | =head2 DateTime | ||||
49 | |||||
50 | A L<DateTime> object. Defaults to: | ||||
51 | |||||
52 | DateTime->now(); | ||||
53 | |||||
54 | Store a precise date in the database. Is searchable and sortable. | ||||
55 | |||||
56 | =head2 ArrayRefOfDateTime | ||||
57 | |||||
58 | An array reference of dates which can have up to 254 elements. Each date follows the rules of C<DateTime>. Use this if you need a multi-value date. See B<Attribute Limits> for special considerations about this type. | ||||
59 | |||||
60 | =head2 HashRef | ||||
61 | |||||
62 | A hash reference. For storage this is serialized into JSON and stored as a C<MediumStr>, therefore it cannot exceed 259,080 characters after serialization. You B<cannot> use it to store a blessed hash reference. It is not searchable, not sortable, and is the slowest field type available. However, it can be quite useful if you need to persist a hash reference. See B<Attribute Limits> for special considerations about this type. | ||||
63 | |||||
64 | =head1 Attribute Limits | ||||
65 | |||||
66 | SimpleDB Items are limited to 256 attributes each. This means that they can have no more than any combination of names, values, or multi values. So you can have 256 name/value pairs, or you could have one multi-valued attribute with 256 elements, or anything in between. For that reason, be careful when adding ArrayRefOfDateTime, ArrayRefOfInt, ArrayRefOfStr, MediumStr, and HashRef elements to your items. | ||||
67 | |||||
68 | =cut | ||||
69 | |||||
70 | 3 | 25µs | 2 | 51µs | # spent 41µs (31+10) within SimpleDB::Class::Types::BEGIN@70 which was called
# once (31µs+10µs) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 70 # spent 41µs making 1 call to SimpleDB::Class::Types::BEGIN@70
# spent 10µs making 1 call to warnings::import |
71 | 3 | 19µs | 2 | 12µs | # spent 10µs (7+2) within SimpleDB::Class::Types::BEGIN@71 which was called
# once (7µs+2µs) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 71 # spent 10µs making 1 call to SimpleDB::Class::Types::BEGIN@71
# spent 2µs making 1 call to strict::import |
72 | 3 | 30µs | 1 | 6µs | # spent 6µs within SimpleDB::Class::Types::BEGIN@72 which was called
# once (6µs+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 72 # spent 6µs making 1 call to SimpleDB::Class::Types::BEGIN@72 |
73 | 3 | 24µs | 2 | 69µs | # spent 40µs (10+29) within SimpleDB::Class::Types::BEGIN@73 which was called
# once (10µs+29µs) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 73 # spent 40µs making 1 call to SimpleDB::Class::Types::BEGIN@73
# spent 29µs making 1 call to Exporter::import |
74 | 3 | 36µs | 2 | 276µs | # spent 142µs (8+134) within SimpleDB::Class::Types::BEGIN@74 which was called
# once (8µs+134µs) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 74 # spent 142µs making 1 call to SimpleDB::Class::Types::BEGIN@74
# spent 134µs making 1 call to JSON::import |
75 | |||||
76 | use MooseX::Types | ||||
77 | # spent 28.6ms (1.01+27.6) within SimpleDB::Class::Types::BEGIN@77 which was called
# once (1.01ms+27.6ms) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 81 # spent 5.66ms making 1 call to MooseX::Types::import | ||||
78 | SdbArrayRefOfStr SdbStr SdbMediumStr | ||||
79 | SdbArrayRefOfInt SdbInt SdbIntAsStr SdbArrayRefOfIntAsStr | ||||
80 | SdbHashRef | ||||
81 | 3 | 151µs | 1 | 28.6ms | )]; # spent 28.6ms making 1 call to SimpleDB::Class::Types::BEGIN@77 |
82 | |||||
83 | 3 | 1.24ms | 2 | 8.71ms | # spent 6.01ms (304µs+5.71) within SimpleDB::Class::Types::BEGIN@83 which was called
# once (304µs+5.71ms) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 83 # spent 6.01ms making 1 call to SimpleDB::Class::Types::BEGIN@83
# spent 2.70ms making 1 call to MooseX::Types::Base::import |
84 | |||||
85 | ## Types | ||||
86 | |||||
87 | subtype SdbStr, | ||||
88 | as Str, | ||||
89 | 572 | 1.38ms | 5 | 652µs | # spent 973µs within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:89] which was called 571 times, avg 2µs/call:
# 571 times (973µs+0s) by SimpleDB::Class::Types::SdbStr at line 252 of Moose/Meta/TypeConstraint.pm, avg 2µs/call # spent 447µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 132µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 50µs making 1 call to __TYPE__::Str
# spent 20µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 3µs making 1 call to Moose::Util::TypeConstraints::where |
90 | |||||
91 | subtype SdbMediumStr, | ||||
92 | as Str, | ||||
93 | 72 | 208µs | 8 | 376µs | # spent 142µs within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:93] which was called 71 times, avg 2µs/call:
# 71 times (142µs+0s) by SimpleDB::Class::Types::SdbMediumStr at line 252 of Moose/Meta/TypeConstraint.pm, avg 2µs/call # spent 264µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 50µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbMediumStr
# spent 47µs making 1 call to __TYPE__::Str
# spent 10µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 2µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 950ns/call
# spent 2µs making 1 call to Moose::Util::TypeConstraints::where
# spent 1µs making 1 call to MooseX::Types::UndefinedType::DESTROY |
94 | |||||
95 | 1 | 11µs | 8 | 1.41ms | subtype SdbArrayRefOfStr, # spent 944µs making 1 call to __TYPE__::ArrayRef
# spent 370µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 48µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 11µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 700ns/call
# spent 600ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
96 | as ArrayRef[SdbStr]; | ||||
97 | |||||
98 | 1 | 5µs | 4 | 257µs | class_type 'DateTime'; # spent 255µs making 1 call to MooseX::Types::CheckedUtilExports::class_type
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 650ns/call
# spent 500ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
99 | |||||
100 | 1 | 7µs | 3 | 441µs | subtype SdbDateTime, # spent 339µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 54µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 48µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbDateTime |
101 | as 'DateTime'; | ||||
102 | |||||
103 | 1 | 11µs | 7 | 1.11ms | subtype SdbArrayRefOfDateTime, # spent 691µs making 1 call to __TYPE__::ArrayRef
# spent 310µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 54µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfDateTime
# spent 41µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbDateTime
# spent 11µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 900ns making 1 call to MooseX::Types::TypeDecorator::DESTROY
# spent 600ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
104 | as ArrayRef[SdbDateTime]; | ||||
105 | |||||
106 | subtype SdbInt, | ||||
107 | as Int, | ||||
108 | 75 | 437µs | 82 | 496µs | # spent 391µs (303+87) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:108] which was called 74 times, avg 5µs/call:
# 74 times (303µs+87µs) by SimpleDB::Class::Types::SdbInt at line 252 of Moose/Meta/TypeConstraint.pm, avg 5µs/call # spent 291µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 87µs making 74 calls to SimpleDB::Class::Types::CORE:match, avg 1µs/call
# spent 54µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbInt
# spent 48µs making 1 call to __TYPE__::Int
# spent 12µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 2µs making 1 call to Moose::Util::TypeConstraints::where
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 700ns/call
# spent 600ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
109 | |||||
110 | subtype SdbIntAsStr, | ||||
111 | as Str, | ||||
112 | 29 | 179µs | 36 | 416µs | # spent 155µs (124+31) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:112] which was called 28 times, avg 6µs/call:
# 28 times (124µs+31µs) by SimpleDB::Class::Types::SdbIntAsStr at line 252 of Moose/Meta/TypeConstraint.pm, avg 6µs/call # spent 274µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 53µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbIntAsStr
# spent 44µs making 1 call to __TYPE__::Str
# spent 31µs making 28 calls to SimpleDB::Class::Types::CORE:match, avg 1µs/call
# spent 11µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 2µs making 1 call to Moose::Util::TypeConstraints::where
# spent 2µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 750ns/call
# spent 600ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
113 | |||||
114 | 1 | 12µs | 8 | 1.08ms | subtype SdbArrayRefOfInt, # spent 686µs making 1 call to __TYPE__::ArrayRef
# spent 291µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 48µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfInt
# spent 42µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbInt
# spent 11µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 600ns/call
# spent 600ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
115 | as ArrayRef[SdbInt]; | ||||
116 | |||||
117 | 1 | 12µs | 8 | 1.07ms | subtype SdbArrayRefOfIntAsStr, # spent 690µs making 1 call to __TYPE__::ArrayRef
# spent 277µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 50µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfIntAsStr
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbIntAsStr
# spent 11µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 600ns/call
# spent 500ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
118 | as ArrayRef[SdbIntAsStr]; | ||||
119 | |||||
120 | 1 | 17µs | 7 | 389µs | subtype SdbHashRef, # spent 275µs making 1 call to MooseX::Types::CheckedUtilExports::subtype
# spent 52µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbHashRef
# spent 46µs making 1 call to __TYPE__::HashRef
# spent 11µs making 1 call to MooseX::Types::CheckedUtilExports::as
# spent 4µs making 1 call to MooseX::Types::UndefinedType::DESTROY
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 650ns/call |
121 | as HashRef; | ||||
122 | |||||
123 | |||||
124 | |||||
125 | |||||
126 | ## Coercions | ||||
127 | |||||
128 | # spent 189µs within SimpleDB::Class::Types::slice_string which was called 16 times, avg 12µs/call:
# 8 times (145µs+0s) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:165] at line 165, avg 18µs/call
# 8 times (44µs+0s) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:163] at line 163, avg 5µs/call | ||||
129 | 138 | 189µs | my $string = shift; | ||
130 | my @array; | ||||
131 | my $i = 1; | ||||
132 | my @parts; | ||||
133 | push @parts, substr $string, 0, 1020, '' while length $string; | ||||
134 | foreach my $part (@parts) { | ||||
135 | push @array, sprintf "%03d|%s", $i, $part; | ||||
136 | $i++; | ||||
137 | } | ||||
138 | return \@array; | ||||
139 | } | ||||
140 | |||||
141 | # spent 152µs (101+51) within SimpleDB::Class::Types::mend_string which was called 7 times, avg 22µs/call:
# 7 times (101µs+51µs) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:170] at line 170, avg 22µs/call | ||||
142 | 48 | 150µs | my $array_ref = shift; | ||
143 | my $string; | ||||
144 | foreach my $part (sort @{$array_ref}) { # spent 10µs making 7 calls to SimpleDB::Class::Types::CORE:sort, avg 1µs/call | ||||
145 | $part =~ m/^\d{3}\|(.*)/xms; # spent 41µs making 10 calls to SimpleDB::Class::Types::CORE:match, avg 4µs/call | ||||
146 | $string .= $1; | ||||
147 | } | ||||
148 | return $string; | ||||
149 | } | ||||
150 | |||||
151 | coerce SdbStr, | ||||
152 | 8 | 44µs | 8 | 1.64ms | # spent 1.68ms (45µs+1.64) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:152] which was called 8 times, avg 210µs/call:
# 8 times (45µs+1.64ms) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 210µs/call # spent 1.64ms making 8 calls to DateTime::Format::Strptime::strftime, avg 205µs/call |
153 | from SdbArrayRefOfDateTime, via { $_->[0] }, | ||||
154 | from SdbMediumStr, via { substr(0,1024,$_) }, | ||||
155 | 20 | 50µs | # spent 33µs within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:155] which was called 20 times, avg 2µs/call:
# 20 times (33µs+0s) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 2µs/call | ||
156 | 1 | 36µs | 20 | 955µs | from Undef, via { '' }; # spent 647µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 58µs making 5 calls to MooseX::Types::CheckedUtilExports::from, avg 12µs/call
# spent 43µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbMediumStr
# spent 40µs making 1 call to __TYPE__::Undef
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbDateTime
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfDateTime
# spent 38µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 6µs making 5 calls to Moose::Util::TypeConstraints::via, avg 1µs/call
# spent 1µs making 2 calls to MooseX::Types::TypeDecorator::DESTROY, avg 700ns/call
# spent 500ns making 1 call to MooseX::Types::UndefinedType::DESTROY |
157 | |||||
158 | coerce SdbIntAsStr, | ||||
159 | 15 | 93µs | 6 | 365µs | # spent 76µs within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:159] which was called 14 times, avg 5µs/call:
# 14 times (76µs+0s) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 5µs/call # spent 266µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 47µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbIntAsStr
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbInt
# spent 10µs making 1 call to MooseX::Types::CheckedUtilExports::from
# spent 1µs making 1 call to Moose::Util::TypeConstraints::via
# spent 800ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
160 | |||||
161 | coerce SdbArrayRefOfStr, | ||||
162 | from SdbArrayRefOfDateTime, via { [ map { to_SdbStr($_) } @{$_} ] }, | ||||
163 | 8 | 32µs | 8 | 44µs | # spent 86µs (42+44) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:163] which was called 8 times, avg 11µs/call:
# 8 times (42µs+44µs) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 11µs/call # spent 44µs making 8 calls to SimpleDB::Class::Types::slice_string, avg 5µs/call |
164 | from SdbStr, via { [ $_ ] }, | ||||
165 | 9 | 93µs | 39 | 1.09ms | # spent 544µs (72+473) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:165] which was called 8 times, avg 68µs/call:
# 8 times (72µs+473µs) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 68µs/call # spent 363µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 327µs making 8 calls to JSON::to_json, avg 41µs/call
# spent 145µs making 8 calls to SimpleDB::Class::Types::slice_string, avg 18µs/call
# spent 46µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfDateTime
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbMediumStr
# spent 38µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbHashRef
# spent 38µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 32µs making 4 calls to MooseX::Types::CheckedUtilExports::from, avg 8µs/call
# spent 13µs making 8 calls to JSON::XS::DESTROY, avg 2µs/call
# spent 4µs making 4 calls to Moose::Util::TypeConstraints::via, avg 900ns/call
# spent 800ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
166 | 1 | 7µs | 4 | 56µs | from Undef, via { [''] }; # spent 45µs making 1 call to __TYPE__::Undef
# spent 9µs making 1 call to MooseX::Types::CheckedUtilExports::from
# spent 1µs making 1 call to Moose::Util::TypeConstraints::via
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
167 | |||||
168 | coerce SdbMediumStr, | ||||
169 | from SdbStr, via { $_ }, | ||||
170 | 7 | 32µs | 7 | 152µs | # spent 184µs (32+152) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:170] which was called 7 times, avg 26µs/call:
# 7 times (32µs+152µs) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 26µs/call # spent 152µs making 7 calls to SimpleDB::Class::Types::mend_string, avg 22µs/call |
171 | 1 | 20µs | 12 | 554µs | from Undef, via { '' }; # spent 310µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 63µs making 1 call to __TYPE__::Undef
# spent 54µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 44µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 42µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbMediumStr
# spent 38µs making 3 calls to MooseX::Types::CheckedUtilExports::from, avg 12µs/call
# spent 4µs making 3 calls to Moose::Util::TypeConstraints::via, avg 1µs/call
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
172 | |||||
173 | coerce SdbArrayRefOfDateTime, | ||||
174 | from SdbArrayRefOfStr, via { [ map { to_SdbDateTime($_) } @{$_} ] }, | ||||
175 | 1 | 12µs | 9 | 430µs | from SdbDateTime, via { [ $_ ] }; # spent 287µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 46µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfDateTime
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbDateTime
# spent 17µs making 2 calls to MooseX::Types::CheckedUtilExports::from, avg 8µs/call
# spent 2µs making 2 calls to Moose::Util::TypeConstraints::via, avg 1µs/call
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
176 | |||||
177 | coerce SdbDateTime, | ||||
178 | # spent 28.2ms (41µs+28.1) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:185] which was called 5 times, avg 5.63ms/call:
# 5 times (41µs+28.1ms) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 5.63ms/call | ||||
179 | 10 | 67µs | 5 | 23µs | if ($_ =~ m/\d{4}-\d\d-\d\d \d\d:\d\d:\d\d \d+ \+\d{4}/ ) { # spent 23µs making 5 calls to SimpleDB::Class::Types::CORE:match, avg 5µs/call |
180 | return DateTime::Format::Strptime::strptime('%Y-%m-%d %H:%M:%S %N %z', $_); # spent 28.1ms making 5 calls to DateTime::Format::Strptime::strptime, avg 5.62ms/call | ||||
181 | } | ||||
182 | else { | ||||
183 | return DateTime->now; | ||||
184 | } | ||||
185 | }, | ||||
186 | 5 | 24µs | 5 | 28.7ms | # spent 28.8ms (26µs+28.7) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:186] which was called 5 times, avg 5.75ms/call:
# 5 times (26µs+28.7ms) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 5.75ms/call # spent 28.7ms making 5 calls to MooseX::Types::__ANON__[MooseX/Types.pm:486], avg 5.75ms/call |
187 | from SdbArrayRefOfDateTime, via { $_->[0] }, | ||||
188 | 1 | 27µs | 15 | 564µs | from Undef, via { DateTime->now }; # spent 326µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 45µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbDateTime
# spent 40µs making 1 call to __TYPE__::Undef
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfDateTime
# spent 31µs making 4 calls to MooseX::Types::CheckedUtilExports::from, avg 8µs/call
# spent 4µs making 4 calls to Moose::Util::TypeConstraints::via, avg 1µs/call
# spent 600ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
189 | |||||
190 | coerce SdbArrayRefOfInt, | ||||
191 | from SdbArrayRefOfStr, via { [ map { to_SdbInt($_) } @{$_} ] }, | ||||
192 | 1 | 18µs | 9 | 448µs | from SdbInt, via { [ $_ ] }; # spent 295µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 46µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfInt
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbInt
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 25µs making 2 calls to MooseX::Types::CheckedUtilExports::from, avg 12µs/call
# spent 2µs making 2 calls to Moose::Util::TypeConstraints::via, avg 1µs/call
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
193 | |||||
194 | coerce SdbArrayRefOfIntAsStr, | ||||
195 | 1 | 9µs | 6 | 390µs | from SdbArrayRefOfInt, via { [ map { to_SdbIntAsStr($_) } @{$_} ] }; # spent 287µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 46µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfIntAsStr
# spent 46µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfInt
# spent 10µs making 1 call to MooseX::Types::CheckedUtilExports::from
# spent 1µs making 1 call to Moose::Util::TypeConstraints::via
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
196 | |||||
197 | coerce SdbInt, | ||||
198 | # spent 6.95ms (69µs+6.88) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:205] which was called 9 times, avg 772µs/call:
# 9 times (69µs+6.88ms) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 772µs/call | ||||
199 | 9 | 129µs | 10 | 13.7ms | if ($_ =~ m/^int(\d{15})$/) { # spent 6.88ms making 9 calls to SimpleDB::Class::Types::CORE:match, avg 765µs/call
# spent 6.83ms making 1 call to utf8::SWASHNEW |
200 | return $1 - 1000000000; | ||||
201 | } | ||||
202 | else { | ||||
203 | return 0; | ||||
204 | } | ||||
205 | }, | ||||
206 | 5 | 26µs | 5 | 624µs | # spent 648µs (23+625) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:206] which was called 5 times, avg 130µs/call:
# 5 times (23µs+625µs) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 130µs/call # spent 624µs making 5 calls to MooseX::Types::__ANON__[MooseX/Types.pm:486], avg 125µs/call |
207 | from SdbArrayRefOfInt, via { $_->[0] }, | ||||
208 | 1 | 19µs | 15 | 585µs | from Undef, via { 0 }; # spent 341µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 45µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbInt
# spent 41µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 39µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfInt
# spent 39µs making 1 call to __TYPE__::Undef
# spent 38µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 37µs making 4 calls to MooseX::Types::CheckedUtilExports::from, avg 9µs/call
# spent 4µs making 4 calls to Moose::Util::TypeConstraints::via, avg 925ns/call
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
209 | |||||
210 | coerce SdbHashRef, | ||||
211 | from Undef, via { {} }, | ||||
212 | # spent 1.25ms (51µs+1.20) within SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:221] which was called 5 times, avg 250µs/call:
# 5 times (51µs+1.20ms) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/TypeCoercion.pm:67] at line 63 of Moose/Meta/TypeCoercion.pm, avg 250µs/call | ||||
213 | 20 | 48µs | 15 | 1.20ms | my $hash_ref = eval{ JSON::from_json(to_SdbMediumStr($_)) }; # spent 1.02ms making 5 calls to MooseX::Types::__ANON__[MooseX/Types.pm:486], avg 203µs/call
# spent 182µs making 5 calls to JSON::from_json, avg 36µs/call
# spent 7µs making 5 calls to JSON::XS::DESTROY, avg 1µs/call |
214 | if ($@) { | ||||
215 | warn "Got $@ coercing json into hash ref"; | ||||
216 | return {}; | ||||
217 | } | ||||
218 | else { | ||||
219 | return $hash_ref; | ||||
220 | } | ||||
221 | }, | ||||
222 | 1 | 17µs | 12 | 522µs | from SdbStr, via { {} }; # spent 318µs making 1 call to MooseX::Types::CheckedUtilExports::coerce
# spent 50µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbStr
# spent 46µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbHashRef
# spent 41µs making 1 call to __TYPE__::Undef
# spent 40µs making 1 call to __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr
# spent 24µs making 3 calls to MooseX::Types::CheckedUtilExports::from, avg 8µs/call
# spent 3µs making 3 calls to Moose::Util::TypeConstraints::via, avg 967ns/call
# spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
223 | |||||
224 | |||||
225 | =head1 LEGAL | ||||
226 | |||||
227 | SimpleDB::Class is Copyright 2009-2010 Plain Black Corporation (L<http://www.plainblack.com/>) and is licensed under the same terms as Perl itself. | ||||
228 | |||||
229 | =cut | ||||
230 | |||||
231 | |||||
232 | 1 | 120µs | 1 | 700ns | 1; # spent 700ns making 1 call to MooseX::Types::TypeDecorator::DESTROY |
# spent 7.06ms (236µs+6.83) within SimpleDB::Class::Types::CORE:match which was called 126 times, avg 56µs/call:
# 74 times (87µs+0s) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:108] at line 108 of ../lib/SimpleDB/Class/Types.pm, avg 1µs/call
# 28 times (31µs+0s) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:112] at line 112 of ../lib/SimpleDB/Class/Types.pm, avg 1µs/call
# 10 times (41µs+0s) by SimpleDB::Class::Types::mend_string at line 145 of ../lib/SimpleDB/Class/Types.pm, avg 4µs/call
# 9 times (53µs+6.83ms) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:205] at line 199 of ../lib/SimpleDB/Class/Types.pm, avg 765µs/call
# 5 times (23µs+0s) by SimpleDB::Class::Types::__ANON__[../lib/SimpleDB/Class/Types.pm:185] at line 179 of ../lib/SimpleDB/Class/Types.pm, avg 5µs/call | |||||
# spent 10µs within SimpleDB::Class::Types::CORE:sort which was called 7 times, avg 1µs/call:
# 7 times (10µs+0s) by SimpleDB::Class::Types::mend_string at line 144 of ../lib/SimpleDB/Class/Types.pm, avg 1µs/call |