差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
dotnet:collection_generic_performance [2009/03/25 10:01] – ともやん | dotnet:collection_generic_performance [2019/05/18 02:23] (現在) – 外部編集 非ログインユーザー | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== コレクション | + | ====== コレクション クラス の性能比較 ====== |
+ | 計算量や速度については、[[algorithm: | ||
- | ===== O-記法と計算量/ | + | ===== System.Collections.Generic 名前空間 |
- | ^速度^高速 | + | ==== Dictionary< |
- | ^計算量^少ない | + | |
- | ^記法|O(1)|O(log n)|O(n)|O(n log n)|O(n< | + | |
- | ^名称関数|定数|対数|線形|準線形、線形対数|二乗| | + | |
- | O-記法については [[http:// | + | |
- | + | ||
- | ===== Dictionary< | + | |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 20: | 行 15: | ||
|Item |O(1)に近い | |Item |O(1)に近い | ||
- | ===== HashSet< | + | ==== HashSet< |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 30: | 行 25: | ||
|Count | |Count | ||
- | ===== LinkedList< | + | ==== LinkedList< |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 43: | 行 38: | ||
|Count、First、Last | |Count、First、Last | ||
- | ===== List< | + | ==== List< |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 64: | 行 59: | ||
|Item |O(1) | | |Item |O(1) | | ||
- | ===== Queue< | + | ==== Queue< |
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Clear | ||
+ | |Contains | ||
+ | |Dequeue | ||
+ | |Enqueue | ||
+ | |Peek |O(1) | | ||
+ | |TrimExcess | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |||
+ | ==== SortedDictionary< | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Add |O(log n) | | ||
+ | |Clear | ||
+ | |ContainsKey | ||
+ | |ContainsValue | ||
+ | |Remove | ||
+ | |TryGetValue | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |Item |取得: O(log n)\\ 設定: O(log n) | | ||
+ | |||
+ | ==== SortedList< | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Add |未ソートデータ追加: | ||
+ | |Clear | ||
+ | |ContainsKey | ||
+ | |ContainsValue | ||
+ | |IndexOfKey | ||
+ | |IndexOfValue | ||
+ | |Remove | ||
+ | |RemoveAt | ||
+ | |TrimExcess | ||
+ | |TryGetValue | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |Item |取得: O(log n)\\ 設定: O(log n)\\ 未ソートデータ追加: | ||
+ | |||
+ | ==== Stack< | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Clear | ||
+ | |Contains | ||
+ | |Peek |O(1) | | ||
+ | |Pop |O(1) | | ||
+ | |Push |O(1) | | ||
+ | |TrimExcess | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |||
+ | ===== System.Collections.Specialized 名前空間 ===== | ||
+ | ==== HybridDictionary | ||
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 71: | 行 121: | ||
| | | | | | | | ||
- | ===== SortedDictionary< | + | ==== ListDictionary |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 78: | 行 128: | ||
| | | | | | | | ||
- | ===== SortedList< | + | ==== NameObjectCollectionBase |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
- | |Add |O(n)\\ 末尾追加: | + | | | | |
^プロパティ^^ | ^プロパティ^^ | ||
- | |Count |O(1) | | + | | | | |
- | |Item |取得: O(log n)\\ 設定(キー存在): | + | |
- | ===== Stack< | + | ==== NameValueCollection |
^処理^計算量^ | ^処理^計算量^ | ||
^メソッド^^ | ^メソッド^^ | ||
行 92: | 行 141: | ||
^プロパティ^^ | ^プロパティ^^ | ||
| | | | | | | | ||
+ | |||
+ | ==== OrderedDictionary ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== StringCollection ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | | | | | ||
+ | ^プロパティ^^ | ||
+ | | | | | ||
+ | |||
+ | ==== StringDictionary ==== | ||
+ | ^処理^計算量^ | ||
+ | ^メソッド^^ | ||
+ | |Add |O(1) | | ||
+ | |Clear | ||
+ | |ContainsKey | ||
+ | |ContainsValue | ||
+ | |CopyTo | ||
+ | |GetEnumerator | ||
+ | |Remove | ||
+ | ^プロパティ^^ | ||
+ | |Count | ||
+ | |Item |O(1) | | ||
+ | |Keys |O(1) | | ||
+ | |Values |