色々やってみた。
Collection:Hashtable Insert 100000 : 13(msec) AccessRandom 100000 : 6(msec) SequentialAccess 100000 : 9(msec) ------------------------------- Collection:SortedList Insert 100000 : 27(msec) AccessRandom 100000 : 22(msec) SequentialAccess 100000 : 1(msec) ------------------------------- Collection:ListDictionary Insert 100000 : 251(msec) AccessRandom 100000 : 875(msec) SequentialAccess 100000 : 1(msec) ------------------------------- Collection:HybridDictionary Insert 100000 : 10(msec) AccessRandom 100000 : 17(msec) SequentialAccess 100000 : 1(msec) ------------------------------- Collection:StringDictionary Insert 100000 : 12(msec) AccessRandom 100000 : 19(msec) SequentialAccess 100000 : 1(msec) ------------------------------- Collection:NameValueCollection Insert 100000 : 22(msec) AccessRandom 100000 : 30(msec) SequentialAccess 100000 : 1(msec) -------------------------------
ListDictionary の性能はひどいな。
ランダムアクセスに強いHashtableと、シーケンシャルアクセスに強いSortedList。
適当に状態を切り替えるHybridは軽くチート。
StringDictionary は文字列特化だけど、性能はHybridとさして変わらない。多分型変換コスト位しか違わない。
NameValueCollection はSortedListに実装が近いのかな?知らんけど。