← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:39 2010

File /data/SimpleDB-Class/author.t/05.Domain_and_Item.t
Statements Executed 115
Statement Execution Time 4.75ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111629µs780µsmain::::BEGIN@3 main::BEGIN@3
111161µs854msmain::::BEGIN@13 main::BEGIN@13
1118µs8µsMoose::Util::TypeConstraints::OptimizedConstraints::::BEGIN@26Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@26
0000s0smain::::RUNTIME main::RUNTIME
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
131.09ms218.0msuse Test::More tests => 51;
# spent 16.3ms making 1 call to main::BEGIN@1 # spent 1.75ms making 1 call to Test::Builder::Module::import
23108µs211.8msuse Test::Deep;
# spent 11.7ms making 1 call to main::BEGIN@2 # spent 175µs making 1 call to Exporter::import
33130µs2879µs
# spent 780µs (629+152) within main::BEGIN@3 which was called # once (629µs+152µs) by main::RUNTIME at line 3
use lib ('../lib', 'lib');
# spent 780µs making 1 call to main::BEGIN@3 # spent 98µs making 1 call to lib::import
413µs$|=1;
5
614µsmy $access = $ENV{AWS_ACCESS_KEY};
712µsmy $secret = $ENV{AWS_SECRET_ACCESS_KEY};
8
911µsunless (defined $access && defined $secret) {
10 die "You need to set environment variables AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY to run these tests.";
11}
12
1332.18ms1854ms
# spent 854ms (161µs+854) within main::BEGIN@13 which was called # once (161µs+854ms) by main::RUNTIME at line 13
use Foo;
# spent 854ms making 1 call to main::BEGIN@13
1418µsmy %params = (secret_key=>$secret, access_key=>$access, cache_servers=>[{host=>'127.0.0.1', port=>11211}]);
151700nsif ($ARGV[0]) {
16 $params{domain_prefix} = $ARGV[0];
17}
18112µs1735µsmy $foo = Foo->new(%params);
# spent 735µs making 1 call to SimpleDB::Class::new
1918µs21.17ms$foo->cache->flush;
# spent 1.10ms making 1 call to SimpleDB::Class::Cache::flush # spent 65µs making 1 call to SimpleDB::Class::cache
2018µs1174µsmy $domain = $foo->domain('foo_domain');
# spent 174µs making 1 call to SimpleDB::Class::domain
2114µs1570µsisa_ok($domain,'SimpleDB::Class::Domain');
# spent 570µs making 1 call to Test::More::isa_ok
2218µs2339µsisa_ok($domain->simpledb,'SimpleDB::Class');
# spent 332µs making 1 call to Test::More::isa_ok # spent 6µs making 1 call to SimpleDB::Class::Domain::simpledb
23
2416µs198µsmy $parent = $foo->domain('foo_parent');
# spent 98µs making 1 call to SimpleDB::Class::domain
25136µs21.55sok($parent->create, 'create a domain');
# spent 1.55s making 1 call to SimpleDB::Class::Domain::create # spent 407µs making 1 call to Test::More::ok
2615µs
# spent 8µs within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@26 which was called # once (8µs+0s) by Moose::Util::TypeConstraints::OptimizedConstraints::CORE:match at line 0
my $domain_expected = 'foo_parent';
2711µsif ($ARGV[0]) {
28 $domain_expected = $ARGV[0].$domain_expected;
29}
30129µs269.3msok(grep({$_ eq $domain_expected} @{$foo->list_domains}), 'got created domain');
# spent 68.9ms making 1 call to SimpleDB::Class::list_domains # spent 366µs making 1 call to Test::More::ok
31111µs277.4msis($parent->count, 0, 'should be 0 items');
# spent 76.7ms making 1 call to SimpleDB::Class::Domain::count # spent 718µs making 1 call to Test::More::is
32110µs1293msmy $parent_one = $parent->insert({title=>'One'},id=>'one');
# spent 293ms making 1 call to SimpleDB::Class::Domain::insert
33117µs2492ms$parent->insert({title=>'Two'},id=>'two');
# spent 492ms making 1 call to SimpleDB::Class::Domain::insert # spent 123µs making 1 call to Moose::Object::DESTROY
34111µs264.1msis($parent->count(consistent=>1), 2, 'should be 2 items');
# spent 63.6ms making 1 call to SimpleDB::Class::Domain::count # spent 550µs making 1 call to Test::More::is
35
36110µs11.25s$domain->create;
# spent 1.25s making 1 call to SimpleDB::Class::Domain::create
37122µs2117msok($domain->insert({color=>'red',size=>'large',parentId=>'one',quantity=>5}, id=>'largered'), 'adding item with id');
# spent 116ms making 1 call to SimpleDB::Class::Domain::insert # spent 480µs making 1 call to Test::More::ok
38144µs3340msok($domain->insert({color=>'blue',size=>'small',parentId=>'two',quantity=>1}), 'adding item without id');
# spent 340ms making 1 call to SimpleDB::Class::Domain::insert # spent 496µs making 1 call to Test::More::ok # spent 106µs making 1 call to Moose::Object::DESTROY
39134µs45.46msis($domain->find('largered')->size, 'large', 'find() works');
# spent 4.81ms making 1 call to SimpleDB::Class::Domain::find # spent 532µs making 1 call to Test::More::is # spent 114µs making 1 call to Moose::Object::DESTROY # spent 3µs making 1 call to Foo::Domain::size
40
41122µs2318msmy $x = $domain->insert({color=>'orange',size=>'large',parentId=>'one',properties=>{this=>'that'},quantity=>3});
# spent 318ms making 1 call to SimpleDB::Class::Domain::insert # spent 60µs making 1 call to Moose::Object::DESTROY
4215µs1523µsisa_ok($x, 'Foo::Domain');
# spent 523µs making 1 call to Test::More::isa_ok
43128µs313.2mscmp_deeply($x->to_hashref, {properties=>{this=>'that'}, color=>'orange',size=>'large',size_formatted=>'Large',parentId=>'one', start_date=>ignore(), components=>[], notes=>'', quantity=>3}, 'to_hashref()');
# spent 11.4ms making 1 call to Test::Deep::cmp_deeply # spent 1.63ms making 1 call to Test::Deep::__ANON__[Test/Deep.pm:92] # spent 159µs making 1 call to SimpleDB::Class::Item::to_hashref
44135µs2319ms$domain->insert({color=>'green',size=>'small',parentId=>'two',quantity=>11});
# spent 319ms making 1 call to SimpleDB::Class::Domain::insert # spent 96µs making 1 call to Moose::Object::DESTROY
45135µs2123ms$domain->insert({color=>'black',size=>'huge',parentId=>'one',quantity=>2});
# spent 122ms making 1 call to SimpleDB::Class::Domain::insert # spent 90µs making 1 call to Moose::Object::DESTROY
46113µs285.8msis($domain->max('quantity', consistent=>1), 11, 'max');
# spent 85.2ms making 1 call to SimpleDB::Class::Domain::max # spent 519µs making 1 call to Test::More::is
4719µs272.9msis($domain->min('quantity', consistent=>1), 1, 'min');
# spent 72.1ms making 1 call to SimpleDB::Class::Domain::min # spent 703µs making 1 call to Test::More::is
48115µs272.1msis($domain->max('quantity',consistent=>1, where=>{parentId=>'one'}), 5, 'max with clause');
# spent 71.6ms making 1 call to SimpleDB::Class::Domain::max # spent 526µs making 1 call to Test::More::is
49113µs257.5msis($domain->min('quantity', consistent=>1, where=>{parentId=>'one'}), 2, 'min with clause');
# spent 57.0ms making 1 call to SimpleDB::Class::Domain::min # spent 512µs making 1 call to Test::More::is
50
5119µs1211µsmy $foos = $domain->search(where=>{size=>'small'}, consistent=>1);
# spent 211µs making 1 call to SimpleDB::Class::Domain::search
5213µs1275µsisa_ok($foos, 'SimpleDB::Class::ResultSet');
# spent 275µs making 1 call to Test::More::isa_ok
53112µs264.5msisa_ok($foos->next, 'Foo::Domain');
# spent 64.1ms making 1 call to SimpleDB::Class::ResultSet::next # spent 375µs making 1 call to Test::More::isa_ok
54110µs22.35msmy $a_domain = $foos->next;
# spent 2.28ms making 1 call to SimpleDB::Class::ResultSet::next # spent 68µs making 1 call to Moose::Object::DESTROY
5518µs2247µsok($a_domain->can('size'), 'attribute methods created');
# spent 246µs making 1 call to Test::More::ok # spent 1µs making 1 call to UNIVERSAL::can
56118µs2261µsok(!$a_domain->can('title'), 'other class attribute methods not created');
# spent 250µs making 1 call to Test::More::ok # spent 11µs making 1 call to UNIVERSAL::can
5715µs2417µsis($a_domain->size, 'small', 'fetched an item from the result set');
# spent 415µs making 1 call to Test::More::is # spent 2µs making 1 call to Foo::Domain::size
58112µs2163µs$foos = $domain->search(consistent=>1, where=>{'itemName()'=>$a_domain->id});
# spent 157µs making 1 call to SimpleDB::Class::Domain::search # spent 6µs making 1 call to SimpleDB::Class::Item::id
5912µs171.7msmy $b_domain = $foos->next;
# spent 71.7ms making 1 call to SimpleDB::Class::ResultSet::next
60112µs3508µsis($b_domain->id, $a_domain->id, "searching on itemName() works");
# spent 496µs making 1 call to Test::More::is # spent 12µs making 2 calls to SimpleDB::Class::Item::id, avg 6µs/call
61112µs1194µs$foos = $domain->search(where=>{size=>'small', 'itemName()'=>['>','0']}, consistent=>1, order_by=>'itemName()');
# spent 194µs making 1 call to SimpleDB::Class::Domain::search
6218µs154.0ms$a_domain = $foos->next;
# spent 54.0ms making 1 call to SimpleDB::Class::ResultSet::next
63121µs22.52ms$b_domain = $foos->next;
# spent 2.45ms making 1 call to SimpleDB::Class::ResultSet::next # spent 71µs making 1 call to Moose::Object::DESTROY
64120µs4784µsok($a_domain->id < $b_domain->id, 'order by itemName() works');
# spent 716µs making 1 call to Test::More::ok # spent 60µs making 1 call to Moose::Object::DESTROY # spent 8µs making 2 calls to SimpleDB::Class::Item::id, avg 4µs/call
6519µs1320msmy $c_domain = $b_domain->copy;
# spent 320ms making 1 call to SimpleDB::Class::Item::copy
66110µs3531µsis($b_domain->size, $c_domain->size, "copy() works.");
# spent 523µs making 1 call to Test::More::is # spent 8µs making 2 calls to Foo::Domain::size, avg 4µs/call
6719µs3292µscmp_ok($b_domain->id, 'ne', $c_domain->id, "copy() provides new id");
# spent 284µs making 1 call to Test::More::cmp_ok # spent 9µs making 2 calls to SimpleDB::Class::Item::id, avg 4µs/call
68114µs1189µs$foos = $domain->search(where=>{size=>'large'}, consistent=>1);
# spent 189µs making 1 call to SimpleDB::Class::Domain::search
6917µs277.1msis($foos->count, 2, 'counting items in a result set');
# spent 76.6ms making 1 call to SimpleDB::Class::ResultSet::count # spent 476µs making 1 call to Test::More::is
70110µs1158µs$foos = $domain->search(consistent=>1, where=>{size=>'large'});
# spent 158µs making 1 call to SimpleDB::Class::Domain::search
71110µs2113msis($foos->count(where=>{color=>'orange'}), 1, 'counting subset of items in a result set');
# spent 112ms making 1 call to SimpleDB::Class::ResultSet::count # spent 498µs making 1 call to Test::More::is
72
73121µs371.0msis($parent_one->domains->count, 3, "can count result set");
# spent 70.2ms making 1 call to SimpleDB::Class::ResultSet::count # spent 482µs making 1 call to Test::More::is # spent 307µs making 1 call to Foo::Parent::domains
74126µs357.7msis($parent_one->domains(where=>{color=>'red'})->count, 1, "can narrow relationship");
# spent 56.8ms making 1 call to SimpleDB::Class::ResultSet::count # spent 577µs making 1 call to Test::More::is # spent 267µs making 1 call to Foo::Parent::domains
75
7616µs1132µsmy $children = $foo->domain('foo_child');
# spent 132µs making 1 call to SimpleDB::Class::domain
77110µs11.25s$children->create;
# spent 1.25s making 1 call to SimpleDB::Class::Domain::create
78110µs1132msmy $child = $children->insert({domainId=>'largered'});
# spent 132ms making 1 call to SimpleDB::Class::Domain::insert
7915µs1452µsisa_ok($child, 'Foo::Child');
# spent 452µs making 1 call to Test::More::isa_ok
80111µs187.8msmy $subchild = $children->insert({domainId=>'largered', class=>'Foo::SubChild'});
# spent 87.8ms making 1 call to SimpleDB::Class::Domain::insert
8115µs1574µsisa_ok($subchild, 'Foo::SubChild');
# spent 574µs making 1 call to Test::More::isa_ok
82
8318µs14.40msmy $largered = $domain->find('largered', set => { parent => $parent_one } );
# spent 4.40ms making 1 call to SimpleDB::Class::Domain::find
8415µs2626µsis($parent_one, $largered->parent, 'presetting parent works');
# spent 623µs making 1 call to Test::More::is # spent 3µs making 1 call to Foo::Domain::parent
85111µs3481µsis($largered->parent->title, 'One', 'belongs_to works');
# spent 469µs making 1 call to Test::More::is # spent 6µs making 1 call to Foo::Parent::title # spent 5µs making 1 call to Foo::Domain::parent
8616µs1109µs$largered->parentId('two');
# spent 109µs making 1 call to Foo::Domain::parentId
8716µs31.78msis($largered->parent->title, 'Two', 'belongs to clear works');
# spent 1.32ms making 1 call to Foo::Domain::parent # spent 456µs making 1 call to Test::More::is # spent 3µs making 1 call to Foo::Parent::title
88125µs570.6msis($domain->find('largered')->children->next->domainId, 'largered', 'has_many works');
# spent 66.7ms making 1 call to SimpleDB::Class::ResultSet::next # spent 2.89ms making 1 call to SimpleDB::Class::Domain::find # spent 706µs making 1 call to Test::More::is # spent 248µs making 1 call to Foo::Domain::children # spent 40µs making 1 call to Foo::Child::domainId
89
90135µs2172µsmy $note = 'NOTE:
# spent 172µs making 2 calls to Moose::Object::DESTROY, avg 86µs/call
91This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
92This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
93This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
94This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
95This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
96This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
97This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
98This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
99This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
100This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
101This is a really long note that I am adding to prove that we can have really long notes in SimpleDB.
102';
103
104125µs2338msmy $j = $domain->insert({start_date=>DateTime->new(year=>2000, month=>5, day=>5, hour=>5, minute=>5, second=>5), color=>'orange',size=>'large',parentId=>'one',properties=>{this=>'that'},quantity=>4, notes=>$note, components=>['cotton','dye','thread']});
# spent 337ms making 1 call to SimpleDB::Class::Domain::insert # spent 555µs making 1 call to DateTime::new
105111µs2466µs$foo->cache->flush;
# spent 458µs making 1 call to SimpleDB::Class::Cache::flush # spent 8µs making 1 call to SimpleDB::Class::cache
106111µs2138msmy $j1 = $domain->find($j->id, consistent=>1);
# spent 138ms making 1 call to SimpleDB::Class::Domain::find # spent 9µs making 1 call to SimpleDB::Class::Item::id
10717µs3643µscmp_ok($j->start_date, '==', $j1->start_date, 'dates in are dates out');
# spent 637µs making 1 call to Test::More::cmp_ok # spent 5µs making 2 calls to Foo::Domain::start_date, avg 3µs/call
10817µs3366µsis($j->start_date->year, 2000, 'year');
# spent 359µs making 1 call to Test::More::is # spent 4µs making 1 call to DateTime::year # spent 3µs making 1 call to Foo::Domain::start_date
10915µs3337µsis($j->start_date->month, 5, 'month');
# spent 332µs making 1 call to Test::More::is # spent 3µs making 1 call to Foo::Domain::start_date # spent 2µs making 1 call to DateTime::month
11016µs3334µsis($j->start_date->day, 5, 'day');
# spent 327µs making 1 call to Test::More::is # spent 5µs making 1 call to DateTime::day_of_month # spent 3µs making 1 call to Foo::Domain::start_date
11116µs3341µsis($j->start_date->hour, 5, 'hour');
# spent 333µs making 1 call to Test::More::is # spent 5µs making 1 call to DateTime::hour # spent 3µs making 1 call to Foo::Domain::start_date
11217µs3419µsis($j->start_date->minute, 5, 'minute');
# spent 411µs making 1 call to Test::More::is # spent 4µs making 1 call to DateTime::minute # spent 3µs making 1 call to Foo::Domain::start_date
11317µs3356µsis($j->start_date->second, 5, 'second');
# spent 348µs making 1 call to Test::More::is # spent 4µs making 1 call to Foo::Domain::start_date # spent 3µs making 1 call to DateTime::second
11416µs2376µsis($j1->properties->{this}, 'that', 'hash refs work');
# spent 368µs making 1 call to Test::More::is # spent 8µs making 1 call to Foo::Domain::properties
11516µs2412µsis($j1->notes, $note, 'medium strings work');
# spent 406µs making 1 call to Test::More::is # spent 6µs making 1 call to Foo::Domain::notes
11616µs2367µsis($j1->components->[1], 'dye', 'arrays of strings work');
# spent 362µs making 1 call to Test::More::is # spent 5µs making 1 call to Foo::Domain::components
117
118114µs2391msmy $page2 = $domain->search(
# spent 391ms making 1 call to SimpleDB::Class::ResultSet::paginate # spent 210µs making 1 call to SimpleDB::Class::Domain::search
119 where => { quantity => ['>', 1] },
120 consistent => 1,
121 order_by => 'quantity'
122 )->paginate(2,2);
123118µs35.43msis($page2->next->color, 'orange', "pagination works");
# spent 4.75ms making 1 call to SimpleDB::Class::ResultSet::next # spent 670µs making 1 call to Test::More::is # spent 5µs making 1 call to Foo::Domain::color
124
125116µs178µsmy $bighashref = {this=>'that',really_long_line_to_see_a_multiattribute_hash_ref_work=>'this is me testing to see what happens if i have a string that is too long to fit in one attribute value. perhaps its broken. 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000'};
# spent 78µs making 1 call to Moose::Object::DESTROY
126120µs21.32smy $bigprops = $domain->insert({start_date=>DateTime->new(year=>2000, month=>5, day=>5, hour=>5, minute=>5, second=>5), color=>'orange',size=>'large',parentId=>'one',properties=>$bighashref,quantity=>4, notes=>$note, components=>['cotton','dye','thread']});
# spent 1.32s making 1 call to SimpleDB::Class::Domain::insert # spent 388µs making 1 call to DateTime::new
127
128112µs2372µs$foo->cache->flush;
# spent 364µs making 1 call to SimpleDB::Class::Cache::flush # spent 8µs making 1 call to SimpleDB::Class::cache
129113µs296.5msmy $bigprops2 = $domain->find($bigprops->id, consistent=>1);
# spent 96.5ms making 1 call to SimpleDB::Class::Domain::find # spent 9µs making 1 call to SimpleDB::Class::Item::id
13017µs2482µsis($bigprops2->properties->{really_long_line_to_see_a_multiattribute_hash_ref_work}, $bighashref->{really_long_line_to_see_a_multiattribute_hash_ref_work}, 'long hashref works');
# spent 479µs making 1 call to Test::More::is # spent 3µs making 1 call to Foo::Domain::properties
131
13215µs1164µsmy $rs = $domain->search(limit=>3);
# spent 164µs making 1 call to SimpleDB::Class::Domain::search
1331200nsmy $i = 0;
13414µs164.0mswhile ($rs->next) {
# spent 64.0ms making 1 call to SimpleDB::Class::ResultSet::next
135335µs610.9ms $i++;
# spent 10.7ms making 3 calls to SimpleDB::Class::ResultSet::next, avg 3.57ms/call # spent 162µs making 3 calls to Moose::Object::DESTROY, avg 54µs/call
136}
13714µs1499µsis($i, 3, 'limits are held');
# spent 499µs making 1 call to Test::More::is
138
139111µs153.1msmy $ids = $domain->fetch_ids(where => { color=>'orange' }, consistent=>1);
# spent 53.1ms making 1 call to SimpleDB::Class::Domain::fetch_ids
14015µs1566µsis(scalar(@{$ids}), 3, 'fetch_ids gets the right amount');
# spent 566µs making 1 call to Test::More::is
141125µs2262µsok($bigprops->id ~~ @{$ids}, 'fetch_ids returns expected id');
# spent 255µs making 1 call to Test::More::ok # spent 7µs making 1 call to SimpleDB::Class::Item::id
142
143115µs21.13sok($domain->delete,'deleting domain');
# spent 1.13s making 1 call to SimpleDB::Class::Domain::delete # spent 540µs making 1 call to Test::More::ok
14418µs13.34s$parent->delete;
# spent 3.34s making 1 call to SimpleDB::Class::Domain::delete
14519µs11.12s$children->delete;
# spent 1.12s making 1 call to SimpleDB::Class::Domain::delete
146137µs276.2msok(!grep({$_ eq 'foo_domain'} @{$foo->list_domains}), 'domain deleted');
# spent 75.6ms making 1 call to SimpleDB::Class::list_domains # spent 561µs making 1 call to Test::More::ok
147
148