dotnet:collection_generic_performance

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

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