← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:10 2015

Filename/var/www/foswiki11/lib/Foswiki/Iterator/FilterIterator.pm
StatementsExecuted 705330 statements in 1.24s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
138251531.09s5.68sFoswiki::Iterator::FilterIterator::::hasNextFoswiki::Iterator::FilterIterator::hasNext
4612522279ms330msFoswiki::Iterator::FilterIterator::::nextFoswiki::Iterator::FilterIterator::next
4111611µs671µsFoswiki::Iterator::FilterIterator::::newFoswiki::Iterator::FilterIterator::new
8132503µs774µsFoswiki::Iterator::FilterIterator::::resetFoswiki::Iterator::FilterIterator::reset
11112µs25µsFoswiki::Iterator::FilterIterator::::BEGIN@13Foswiki::Iterator::FilterIterator::BEGIN@13
11110µs15µsFoswiki::Iterator::FilterIterator::::BEGIN@14Foswiki::Iterator::FilterIterator::BEGIN@14
1118µs21µsFoswiki::Iterator::FilterIterator::::BEGIN@15Foswiki::Iterator::FilterIterator::BEGIN@15
1114µs4µsFoswiki::Iterator::FilterIterator::::BEGIN@17Foswiki::Iterator::FilterIterator::BEGIN@17
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2
3=begin
4
5---+ package Foswiki::Iterator::FilterIterator
6
7Iterator that filters another iterator based on the results from a function.
8
9=cut
10
11package Foswiki::Iterator::FilterIterator;
12
13230µs237µs
# spent 25µs (12+12) within Foswiki::Iterator::FilterIterator::BEGIN@13 which was called: # once (12µs+12µs) by Foswiki::Search::InfoCache::BEGIN@26 at line 13
use strict;
# spent 25µs making 1 call to Foswiki::Iterator::FilterIterator::BEGIN@13 # spent 12µs making 1 call to strict::import
14222µs220µs
# spent 15µs (10+5) within Foswiki::Iterator::FilterIterator::BEGIN@14 which was called: # once (10µs+5µs) by Foswiki::Search::InfoCache::BEGIN@26 at line 14
use warnings;
# spent 15µs making 1 call to Foswiki::Iterator::FilterIterator::BEGIN@14 # spent 5µs making 1 call to warnings::import
15225µs234µs
# spent 21µs (8+13) within Foswiki::Iterator::FilterIterator::BEGIN@15 which was called: # once (8µs+13µs) by Foswiki::Search::InfoCache::BEGIN@26 at line 15
use Assert;
# spent 21µs making 1 call to Foswiki::Iterator::FilterIterator::BEGIN@15 # spent 13µs making 1 call to Assert::import
16
172264µs14µs
# spent 4µs within Foswiki::Iterator::FilterIterator::BEGIN@17 which was called: # once (4µs+0s) by Foswiki::Search::InfoCache::BEGIN@26 at line 17
use Foswiki::Iterator ();
# spent 4µs making 1 call to Foswiki::Iterator::FilterIterator::BEGIN@17
18110µsour @ISA = ('Foswiki::Iterator');
19
20=begin TML
21
22---++ ClassMethod new( $iter, $sub, $data )
23Construct a new iterator that will filter $iter based on the results from
24$sub. $sub should return 0 if the next() from $iter should be filtered and
251 if it should be treated as the next item in the sequence.
26
27$data is an optional arbitrary data item which will be passed to $sub in $_[1]
28
29=cut
30
31
# spent 671µs (611+60) within Foswiki::Iterator::FilterIterator::new which was called 41 times, avg 16µs/call: # 41 times (611µs+60µs) by Foswiki::Search::InfoCache::getTopicListIterator at line 580 of /var/www/foswiki11/lib/Foswiki/Search/InfoCache.pm, avg 16µs/call
sub new {
324176µs my ( $class, $iter, $sub, $data ) = @_;
334154µs4136µs ASSERT( UNIVERSAL::isa( $iter, 'Foswiki::Iterator' ) ) if DEBUG;
# spent 36µs making 41 calls to Assert::ASSERTS_OFF, avg 888ns/call
344142µs4123µs ASSERT( ref($sub) eq 'CODE' ) if DEBUG;
# spent 23µs making 41 calls to Assert::ASSERTS_OFF, avg 568ns/call
354163µs my $this = bless( {}, $class );
364142µs $this->{iterator} = $iter;
374118µs $this->{filter} = $sub;
384120µs $this->{data} = $data;
394123µs $this->{next} = undef;
404130µs $this->{pending} = 0;
4141126µs return $this;
42}
43
44# See Foswiki::Iterator for a description of the general iterator contract
45
# spent 5.68s (1.09+4.59) within Foswiki::Iterator::FilterIterator::hasNext which was called 138251 times, avg 41µs/call: # 92000 times (1.01s+4.55s) by Foswiki::Store::SearchAlgorithms::Forking::search at line 104 of /var/www/foswiki11/lib/Foswiki/Store/SearchAlgorithms/Forking.pm, avg 60µs/call # 46125 times (50.9ms+0s) by Foswiki::Iterator::FilterIterator::next at line 61, avg 1µs/call # 85 times (28.7ms+29.4ms) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 215 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 683µs/call # 40 times (7.56ms+5.02ms) by Foswiki::Store::SearchAlgorithms::Forking::search at line 99 of /var/www/foswiki11/lib/Foswiki/Store/SearchAlgorithms/Forking.pm, avg 315µs/call # once (209µs+391µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 209 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm
sub hasNext {
4613825136.1ms my $this = shift;
47138251399ms return 1 if $this->{pending};
484620671.1ms46206224ms while ( $this->{iterator}->hasNext() ) {
# spent 224ms making 46206 calls to Foswiki::ListIterator::hasNext, avg 5µs/call
4952483100ms52483445ms $this->{next} = $this->{iterator}->next();
# spent 445ms making 52483 calls to Foswiki::ListIterator::next, avg 8µs/call
5052483121ms588413.92s if ( &{ $this->{filter} }( $this->{next}, $this->{data} ) ) {
# spent 3.89s making 52483 calls to Foswiki::Search::InfoCache::__ANON__[/var/www/foswiki11/lib/Foswiki/Search/InfoCache.pm:579], avg 74µs/call # spent 28.3ms making 6358 calls to Foswiki::ListIterator::hasNext, avg 4µs/call
514612522.0ms $this->{pending} = 1;
5246125253ms return 1;
53 }
54 }
5581343µs return 0;
56}
57
58# See Foswiki::Iterator for a description of the general iterator contract
59
# spent 330ms (279+50.9) within Foswiki::Iterator::FilterIterator::next which was called 46125 times, avg 7µs/call: # 46040 times (279ms+50.8ms) by Foswiki::Store::SearchAlgorithms::Forking::search at line 100 of /var/www/foswiki11/lib/Foswiki/Store/SearchAlgorithms/Forking.pm, avg 7µs/call # 85 times (335µs+89µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 210 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 5µs/call
sub next {
604612512.1ms my $this = shift;
614612543.0ms4612550.9ms return unless $this->hasNext();
# spent 50.9ms making 46125 calls to Foswiki::Iterator::FilterIterator::hasNext, avg 1µs/call
624612514.6ms $this->{pending} = 0;
6346125170ms return $this->{next};
64}
65
66# See Foswiki::Iterator for a description of the general iterator contract
67
# spent 774µs (503+271) within Foswiki::Iterator::FilterIterator::reset which was called 81 times, avg 10µs/call: # 40 times (290µs+190µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 191 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 12µs/call # 40 times (203µs+75µs) by Foswiki::Store::SearchAlgorithms::Forking::search at line 98 of /var/www/foswiki11/lib/Foswiki/Store/SearchAlgorithms/Forking.pm, avg 7µs/call # once (10µs+5µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 208 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm
sub reset {
688146µs my ($this) = @_;
69
7081226µs81271µs return unless ( $this->{iterator}->reset() );
# spent 271µs making 81 calls to Foswiki::ListIterator::reset, avg 3µs/call
718135µs $this->{next} = undef;
728124µs $this->{pending} = 0;
73
7481191µs return 1;
75}
76
7713µs1;
78__END__