From: Thomas Lamprecht Date: Tue, 23 Jul 2019 07:04:00 +0000 (+0200) Subject: array_intersect: followup: early exit if first empty intersection found X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=26a68cf6d8708a1bb4be192f756cb958282b4381 array_intersect: followup: early exit if first empty intersection found no point in trying more Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 9b5614f..a9addcd 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -1677,6 +1677,7 @@ sub array_intersect { foreach my $element (keys %count) { push @$return_arr, $element if $count{$element} > 1; } + last if scalar(@$return_arr) == 0; # empty intersection, early exit } return $return_arr;