Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1118)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/util/expensive_map.dart

Issue 26662006: Changed LinkedHashSet to Set and LinkedHashMap to Map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: HashMap -> Map. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.util; 5 part of dart2js.util;
6 6
7 /** 7 /**
8 * The expensive map is a data structure useful for tracking down 8 * The expensive map is a data structure useful for tracking down
9 * excessive memory usage due to large maps. It acts as an ordinary 9 * excessive memory usage due to large maps. It acts as an ordinary
10 * hash map, but it uses 10 times more memory (by default). 10 * hash map, but it uses 10 times more memory (by default).
11 */ 11 */
12 class ExpensiveMap<K, V> implements LinkedHashMap<K, V> { 12 class ExpensiveMap<K, V> implements Map<K, V> {
13 13
14 final List _maps; 14 final List _maps;
15 15
16 ExpensiveMap([int copies = 10]) : _maps = new List(copies) { 16 ExpensiveMap([int copies = 10]) : _maps = new List(copies) {
17 assert(copies > 0); 17 assert(copies > 0);
18 for (int i = 0; i < _maps.length; i++) { 18 for (int i = 0; i < _maps.length; i++) {
19 _maps[i] = new LinkedHashMap<K, V>(); 19 _maps[i] = new Map<K, V>();
20 } 20 }
21 } 21 }
22 22
23 int get length => _maps[0].length; 23 int get length => _maps[0].length;
24 bool get isEmpty => _maps[0].isEmpty; 24 bool get isEmpty => _maps[0].isEmpty;
25 bool get isNotEmpty => _maps[0].isNotEmpty; 25 bool get isNotEmpty => _maps[0].isNotEmpty;
26 26
27 Iterable<K> get keys => _maps[0].keys; 27 Iterable<K> get keys => _maps[0].keys;
28 Iterable<V> get values => _maps[0].values; 28 Iterable<V> get values => _maps[0].values;
29 29
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void clear() { 66 void clear() {
67 for (int i = 0; i < _maps.length; i++) { 67 for (int i = 0; i < _maps.length; i++) {
68 _maps[i].clear(); 68 _maps[i].clear();
69 } 69 }
70 } 70 }
71 71
72 String toString() => "expensive(${_maps[0]}x${_maps.length})"; 72 String toString() => "expensive(${_maps[0]}x${_maps.length})";
73 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698