Revision: 1313
Author: [email protected]
Date: Fri Jun 18 10:01:06 2010
Log: Move deletion of donor evals from parent to after the donors loop.
Massive speed improvement where there are many (thousands) of siblings.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1313
Modified:
/trunk/lib/Devel/NYTProf/FileInfo.pm
=======================================
--- /trunk/lib/Devel/NYTProf/FileInfo.pm Wed Jun 16 16:02:00 2010
+++ /trunk/lib/Devel/NYTProf/FileInfo.pm Fri Jun 18 10:01:06 2010
@@ -344,15 +344,34 @@
if $donor_fi->src_digest ne $survivor_fi->src_digest;
# remove eval from NYTP_FIDi_HAS_EVALS
- if (my $eval_fis = $self->[NYTP_FIDi_HAS_EVALS()]) {
+ # XXX DISABLED - moved to after donor loop
+ if (0 and my $eval_fis = $self->[NYTP_FIDi_HAS_EVALS()]) {
my $count = @$eval_fis;
- @$eval_fis = grep { $_ != $donor_fi } @$eval_fis;
- warn "_delete_eval missed" if @$eval_fis == $count;
- # XXX needs to update NYTP_FIDi_SUBS_DEFINED
NYTP_FIDi_SUBS_CALLED ?
+ # XXX this is very expensive when there are many siblings
+ # could possibly be deferred till outside the donor loop
+ # so alll donors could be deleted at once
+ while ($count--) {
+ if ($eval_fis->[$count] == $donor_fi) {
+ splice @$eval_fis, $count, 1;
+ undef $count; # mark as done
+ last;
+ }
+ }
+ warn "_delete_eval missed for ".$donor_fi->filename
+ if defined $count;
}
$donor_fi->_nullify;
}
+
+ # remove donors
+ if (my $eval_fis = $self->[NYTP_FIDi_HAS_EVALS()]) {
+ my %donors = map { +"$_" => 1 } @donors;
+ my $count = @$eval_fis;
+ @$eval_fis = grep { !$donors{$_} } @$eval_fis;
+ warn "_delete_eval mismatch"
+ if @$eval_fis != $count - @donors;
+ }
# now the fid merging is complete...
# look for any anon subs that are effectively duplicates
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]