| OLD | NEW | 
|   1 // Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file |   1 // Copyright (c) 2014, 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 import 'dart:collection' show |   5 import 'dart:collection' show | 
|   6     HashMap, |   6     HashMap, | 
|   7     HashSet; |   7     HashSet; | 
|   8  |   8  | 
|   9 /** |   9 /** | 
|  10  * Helper class for allocating sets and maps appropriate for caching objects |  10  * Helper class for allocating sets and maps appropriate for caching objects | 
|  11  * that can be assumed to be canonicalized. |  11  * that can be assumed to be canonicalized. | 
|  12  * |  12  * | 
|  13  * When compiling dart2js to JavaScript, profiling reveals that identity maps |  13  * When compiling dart2js to JavaScript, profiling reveals that identity maps | 
|  14  * and sets have superior performance.  However, we know that [Object.hashCode] |  14  * and sets have superior performance.  However, we know that [Object.hashCode] | 
|  15  * is slow on the Dart VM.  This class is meant to encapsulate the decision |  15  * is slow on the Dart VM.  This class is meant to encapsulate the decision | 
|  16  * about which data structure is best, and we anticipate specific subclasses |  16  * about which data structure is best, and we anticipate specific subclasses | 
|  17  * for JavaScript and Dart VM in the future. |  17  * for JavaScript and Dart VM in the future. | 
|  18  */ |  18  */ | 
|  19 class CacheStrategy { |  19 class CacheStrategy { | 
|  20   final bool hasIncrementalSupport; |  20   final bool hasIncrementalSupport; | 
|  21  |  21  | 
|  22   CacheStrategy(this.hasIncrementalSupport); |  22   CacheStrategy(this.hasIncrementalSupport); | 
|  23  |  23  | 
|  24   Map newMap() => hasIncrementalSupport ? new HashMap.identity() : null; |  24   Map newMap() => hasIncrementalSupport ? new HashMap.identity() : null; | 
|  25  |  25  | 
|  26   Set newSet() => hasIncrementalSupport ? new HashSet.identity() : null; |  26   Set newSet() => hasIncrementalSupport ? new HashSet.identity() : null; | 
|  27 } |  27 } | 
| OLD | NEW |