差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
dotnet:collection_generic_performance [2009/03/25 01:38] – ともやん | dotnet:collection_generic_performance [2019/05/18 02:23] (現在) – 外部編集 非ログインユーザー | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== コレクション | + | ====== コレクション クラス の性能比較 ====== |
+ | 計算量や速度については、[[algorithm: | ||
- | ^コレクション名^処理^計算量^ | + | ===== System.Collections.Generic |
- | ^Dictionary< | + | ==== Dictionary< |
- | | | + | ^処理^計算量^ |
- | | | + | ^メソッド^^ |
- | | | + | |Add |
- | | | + | |Clear |
- | | | + | |ContainsKey |
- | | | + | |ContainsValue |
- | | | + | |Remove |
- | ^HashSet< | + | ^プロパティ^^ |
- | | | + | |Count |
- | | | + | |Item |O(1)に近い |
- | | |Contains | + | |
- | | |Remove | + | ==== HashSet< |
- | | |Count |O(1) | | + | ^処理^計算量^ |
- | ^LinkedList | + | ^メソッド^^ |
- | | |AddAfter、AddBefore、AddFirst、AddLast | + | |Add |Count <= 容量 O(1)に近い\\ Count > 容量 O(n) - 自動拡張の為 |
- | | |Clear | + | |Clear |
- | | |Contains | + | |Contains |
- | | |Find |O(n) | | + | |Remove |
- | | |FindLast | + | ^プロパティ^^ |
- | | |Remove | + | |Count |O(1) | |
- | | |RemoveFirst | + | |
- | | | + | ==== LinkedList< |
- | | |Count | + | ^処理^計算量^ |
- | | |First |O(1) | | + | ^メソッド^^ |
- | | |Last | + | |AddAfter、AddBefore、AddFirst、AddLast |
- | ^List ||| | + | |Clear |O(n) | |
- | | |Add |Count <= 容量 O(1)\\ Count > 容量 | + | |Contains |
- | | |AddRange | + | |Find |O(n) |
- | | | + | |FindLast |
- | | |Contains | + | |Remove |
- | | |Exists | + | |RemoveFirst、RemoveLast |
- | | |Find、FindAll、FindIndex、FindIndex、FindLastIndex | + | ^プロパティ^^ |
- | | |GetRange | + | |Count、First、Last |
- | | |IndexOf | + | |
- | | |Insert | + | ==== List< |
- | | |InsertRange | + | ^処理^計算量^ |
- | | |LastIndexOf | + | ^メソッド^^ |
- | | | + | |Add |
- | | |Reverse | + | |AddRange |
- | | | + | |Clear |O(n) | |
- | | |Count |O(1) | | + | |Contains |
- | | |Item | + | |Exists |
- | ^Queue | + | |Find、FindAll、FindIndex、FindIndex、FindLastIndex |
- | ^SortedDictionary | + | |GetRange |
- | ^SortedList | + | |IndexOf |
- | ^Stack | + | |Insert |
- | O-記法については [[http:// | + | |InsertRange |
+ | |LastIndexOf | ||
+ | |Remove、RemoveAll、RemoveAt、RemoveRange|O(n) | | ||
+ | |Reverse | ||
+ | |Sort |O(n log n) | | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |Item |O(1) | | ||
+ | |||
+ | ==== Queue< | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Clear | ||
+ | |Contains | ||
+ | |Dequeue | ||
+ | |Enqueue | ||
+ | |Peek |O(1) | ||
+ | |TrimExcess | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |||
+ | ==== SortedDictionary<TKey, | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Add |O(log n) | | ||
+ | |Clear | ||
+ | |ContainsKey | ||
+ | |ContainsValue | ||
+ | |Remove | ||
+ | |TryGetValue | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |Item |取得: O(log n)\\ 設定: O(log n) | | ||
+ | |||
+ | ==== SortedList<TKey, | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Add |未ソートデータ追加: | ||
+ | |Clear | ||
+ | |ContainsKey | ||
+ | |ContainsValue | ||
+ | |IndexOfKey | ||
+ | |IndexOfValue | ||
+ | |Remove | ||
+ | |RemoveAt | ||
+ | |TrimExcess | ||
+ | |TryGetValue | ||
+ | ^プロパティ^^ | ||
+ | |Count |O(1) | | ||
+ | |Item |取得: | ||
+ | |||
+ | ==== Stack< | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Clear |O(n) | | ||
+ | |Contains | ||
+ | |Peek |O(1) | | ||
+ | |Pop |O(1) | | ||
+ | |Push |O(1) | | ||
+ | |TrimExcess | ||
+ | ^プロパティ^^ | ||
+ | |Count |O(1) | | ||
+ | |||
+ | ===== System.Collections.Specialized 名前空間 ===== | ||
+ | ==== HybridDictionary ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== ListDictionary ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== NameObjectCollectionBase ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== NameValueCollection ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== OrderedDictionary ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== StringCollection ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== StringDictionary ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Add |O(1) | | ||
+ | |Clear | ||
+ | |ContainsKey | ||
+ | |ContainsValue | ||
+ | |CopyTo | ||
+ | |GetEnumerator | ||
+ | |Remove | ||
+ | ^プロパティ^^ | ||
+ | |Count |O(1) | | ||
+ | |Item |O(1) | | ||
+ | |Keys |O(1) | | ||
+ | |Values |