Significant performance improvement validating AUTOLOAD methods

This commit is contained in:
Eric A. Miller
2018-04-26 20:53:04 -04:00
parent 8d1681dbfc
commit e5ebda1b1e
2 changed files with 20 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ Version 3.57
* #145 Patch for Huawei (robwwd) * #145 Patch for Huawei (robwwd)
* #228 Huawei aggregate link support * #228 Huawei aggregate link support
* POE and duplex admin support added to L3::Huawei * POE and duplex admin support added to L3::Huawei
* Significant performance improvement validating AUTOLOAD methods
[BUG FIXES] [BUG FIXES]

View File

@@ -4679,16 +4679,26 @@ sub _validate_autoload_method {
} }
# If the parent of the leaf has indexes it is contained within a table
my $indexes = $SNMP::MIB{$oid}{'parent'}{'indexes'};
my $table_leaf = 0; my $table_leaf = 0;
if ( !$globals->{$attr} # This is an expensive check so we assume anything in the funcs and globals
&& ( ( defined $indexes && scalar( @{$indexes} ) > 0 ) # hashes are known. Only for actual MIB leafs should we have to check the
|| $funcs->{$attr} )) # MIB. If the parent of the leaf has indexes it is contained within a table.
if ($funcs->{$attr}) {
$table_leaf = 1;
}
elsif (!$globals->{$attr}) {
# Prevent autovivification
if (exists $SNMP::MIB{$oid} &&
exists $SNMP::MIB{$oid}{'parent'} &&
exists $SNMP::MIB{$oid}{'parent'}{'indexes'} &&
defined $SNMP::MIB{$oid}{'parent'}{'indexes'} &&
scalar( @{$SNMP::MIB{$oid}{'parent'}{'indexes'}} ) > 0)
{ {
$table_leaf = 1; $table_leaf = 1;
} }
}
# Tag on .0 for %GLOBALS and single instance MIB leafs unless # Tag on .0 for %GLOBALS and single instance MIB leafs unless
# the leaf ends in a digit or we are going to use for a set operation # the leaf ends in a digit or we are going to use for a set operation