qshinoの日記

Powershell関係と徒然なこと

配列性能 on PowerShell

配列性能 on PowerShell

PowerShell配列に += で要素を追加する性能が良くないらしい。固定長配列として実装されており、追加時に配列を作り直しているのが原因とのこと。

性能面ではArrayList or List使用を推奨する。Listを使用する場合、

$x = New-Object 'System.Collections.Generic.List[System.String]'
$x.add( "poi" )

ArrayListの場合、

$l  = New-Object System.Collections.ArrayList
$l.add( "poi" )

参考

性能測定

http://tech.guitarrapc.com/entry/2013/09/22/100203

各種罠、自動変換など

http://tech.guitarrapc.com/entry/2015/09/05/012733

配列の使い方

http://capm-network.com/?tag=PowerShell変数

チートシート

http://qiita.com/jca02266/items/a0c71ae90d055ab3893c

List on msdn

https://msdn.microsoft.com/ja-jp/library/6sh2ey19(v=vs.110).aspx

以上