想知道在数组搜索之后是否有机会提高性能o。目前它是16秒。
Measure-Command -Expression {
$a = @()
$b = @()
1..10000 | %{$a += $_}
1..10000 | %{$b += $_}
#Try to resize but still running 16 seconds
[array]::Resize([ref]$a,10000)
[array]::Resize([ref]$b,10000)
foreach ($i in $a){
if ($b -contains $i) {
#write-host $i
}
}
}