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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart

Issue 340023003: Various caches for incremental compilation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart b/dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d27aad5fd9534f4083b576b5605739fcda914221
--- /dev/null
+++ b/dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection' show
+ HashMap,
+ HashSet;
+
+/**
+ * Helper class for allocating sets and maps appropriate for caching objects
+ * that can be assumed to be canonicalized.
+ *
+ * When compiling dart2js to JavaScript, profiling reveals that identity maps
+ * and sets have superior performance. However, we know that [Object.hashCode]
+ * is slow on the Dart VM. This class is meant to encapsulate the decision
+ * about which data structure is best, and we anticipate specific subclasses
+ * for JavaScript and Dart VM in the future.
+ */
+class CacheStrategy {
+ Map newMap() => new HashMap.identity();
+
+ Set newSet() => new HashSet.identity();
+}

Powered by Google App Engine
This is Rietveld 408576698