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

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 24267028: Try caching attribute map to try to improve performance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 8f73476b88f76d38cd1c7ff3a32f1c7ef6fe064b..0bf8fd05bb76e05d8311fd479d1f2e379bb00ae8 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -500,6 +500,7 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
/// This is identical to calling `new Element.tag('video')`.
factory Element.video() => new Element.tag('video');
+ Map<String, String> _cachedAttributeMap;
/**
* All attributes on this element.
*
@@ -510,7 +511,12 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
* (such as 'xlink:href'), additional attributes can be accessed via
* [getNamespacedAttributes].
*/
- Map<String, String> get attributes => new _ElementAttributeMap(this);
+ Map<String, String> get attributes {
+ if (_cachedAttributeMap == null) {
+ _cachedAttributeMap = new _ElementAttributeMap(this);
+ }
+ return _cachedAttributeMap;
+ }
void set attributes(Map<String, String> value) {
Map<String, String> attributes = this.attributes;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698