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

Unified Diff: Source/core/dom/ElementData.h

Issue 105163003: Cache length in ElementData::getAttributeItemIndex() for performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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: Source/core/dom/ElementData.h
diff --git a/Source/core/dom/ElementData.h b/Source/core/dom/ElementData.h
index b7c36f097a53720d0e80ec561c4a7e6ceb3c81ff..3e69d994125949b91cdda2e0a0f84eb8e4f8729a 100644
--- a/Source/core/dom/ElementData.h
+++ b/Source/core/dom/ElementData.h
@@ -185,7 +185,8 @@ inline const Attribute* ElementData::attributeBase() const
inline size_t ElementData::getAttributeItemIndex(const QualifiedName& name, bool shouldIgnoreCase) const
{
const Attribute* begin = attributeBase();
- for (unsigned i = 0; i < length(); ++i) {
+ unsigned len = length();
+ for (unsigned i = 0; i < len; ++i) {
const Attribute& attribute = begin[i];
if (attribute.name().matchesPossiblyIgnoringCase(name, shouldIgnoreCase))
return i;
« 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