Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item12952: Don't scan INC for checkers
We know the exact path, so just require the module, and test the
results. This knocks 1/2 second or more off of the each rpc
request that loads the checkers.  Calling FileUtil::findPackages only
makes sense when wildcard searching for a list.

(Running under NYTProfile it reduced a call jsonrpc from 13 seconds to
7.  )
  • Loading branch information
gac410 committed Sep 22, 2014
1 parent f45eba9 commit b7e84f9
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions core/lib/Foswiki/Configure/Checker.pm
Expand Up @@ -101,24 +101,18 @@ sub loadChecker {
}

my $checkClass = 'Foswiki::Configure::Checkers::' . $id;
my @packages = Foswiki::Configure::FileUtil::findPackages($checkClass);

unless ( scalar(@packages) ) {

# See if a generic type checker exists for this type
my $checkClass = 'Foswiki::Configure::Checkers::' . $item->{typename};
@packages = Foswiki::Configure::FileUtil::findPackages($checkClass);
eval "require $checkClass";
unless ($@) {
return $checkClass->new($item);
}
return undef unless scalar(@packages);

$checkClass = $packages[0];

# See if a generic type checker exists for this type
$checkClass = 'Foswiki::Configure::Checkers::' . $item->{typename};
eval "require $checkClass";
if ($@) {
die "Failed to load checker class $checkClass: $@";
unless ($@) {
return $checkClass->new($item);
}

return $checkClass->new($item);
return undef;
}

=begin TML
Expand Down

0 comments on commit b7e84f9

Please sign in to comment.