Using Item::GetColValue() is faster than relying on Item::AUTOLOAD.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/VMs.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm index ee0c1be24..2e475b722 100644 --- a/testbot/lib/WineTestBot/VMs.pm +++ b/testbot/lib/WineTestBot/VMs.pm @@ -177,16 +177,17 @@ sub InitializeNew($$) $self->SUPER::InitializeNew($Collection); }
+# Sort retired and deleted VMs last +my %_CmpRole = ("retired" => 1, "deleted" => 2); + sub Compare($$) { my ($self, $B) = @_;
- # Sort retired and deleted VMs last - my %RoleOrders = ("retired" => 1, "deleted" => 2); - - return ($RoleOrders{$self->Role} || 0) <=> ($RoleOrders{$B->Role} || 0) || - $self->SortOrder <=> $B->SortOrder || - $self->Name <=> $B->Name; + # Use GetColValue() for performance. + return ($_CmpRole{$self->GetColValue("Role")} || 0) <=> ($_CmpRole{$B->GetColValue("Role")} || 0) || + $self->GetColValue("SortOrder") <=> $B->GetColValue("SortOrder") || + $self->GetColValue("Name") <=> $B->GetColValue("Name"); }
sub HasEnabledRole($)