This queue is for tickets about the Test-Unit CPAN distribution.

Report information
The Basics
Id:
124621
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
rowaa [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)

Attachments


Subject: [PATCH] Startup is slow in big suites due to get_matching_methods
I have a big test suite in old project with about 6,5k test. When I run a full suite there's a very noticeable 15-20 seconds delay before output even starts ticking. NYTProf shows all this time is spent in get_matching_methods, retrieving all test names for entire suite. Right now it uses Devel::Symdump, that does a lot of extra unnecessary work for this task, like testing each glob for what type it is and wrapping/unwrapping data in module's internal storage. Replacing calls to it with simple loop over symtable and test if found entry is sub reduced this startup delay below 0.5s for me - i.e. over order of magnitude and makes T::U have one less depend. Relevant change to get_matching_methods and accompanying change to a single line with regexp in list_tests in attach
Subject: Test-Unit-TestCase-faster-start.pl
sub list_tests { my $class = ref($_[0]) || $_[0]; my @tests = (); no strict 'refs'; if (@{"$class\::TESTS"}) { push @tests, @{"$class\::TESTS"}; } else { push @tests, $class->get_matching_methods(qr/^test/); } push @tests, map {$_->can('list_tests') ? $_->list_tests : () } @{"$class\::ISA"}; my %tests = map {$_ => ''} @tests; return keys %tests; } sub get_matching_methods { my $class = ref($_[0]) || $_[0]; my $re = $_[1]; no strict 'refs'; my $symtable = *{$class . '::'}; return grep { defined &{$class . '::' . $_} and /$re/ } keys %$symtable; }


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.