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

Issue 177613003: Consistently cache ElementData::length() before loops (Closed)

Created:
6 years, 10 months ago by Inactive
Modified:
6 years, 10 months ago
Reviewers:
esprehn, adamk, eseidel
CC:
blink-reviews, sof, eae+blinkwatch, dglazkov+blink, adamk+blink_chromium.org, rwlbuis
Visibility:
Public.

Description

Consistently cache ElementData::length() before loops Consistently cache ElementData::length() before loops as this method is not a simple getter (it contains a conditional branch) and we don't want to call it for each iteration of the loop. Previously, it was only cached before some of the loops. This CL makes this consistent. Also, use length for the variable instead of len, as we prefer to avoid abbreviations, as per coding style. Same thing for Element::attributeCount() as it calls ElementData::length(). R=adamk, eseidel Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167794

Patch Set 1 #

Patch Set 2 : Cache Element::attributeCount() as well #

Patch Set 3 : Fix style errors #

Patch Set 4 : Add comments #

Patch Set 5 : Fix test failure #

Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -25 lines) Patch
M Source/core/css/SelectorChecker.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/Element.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/Element.cpp View 1 2 3 4 4 chunks +8 lines, -3 lines 0 comments Download
M Source/core/dom/ElementData.h View 1 2 3 4 chunks +7 lines, -5 lines 0 comments Download
M Source/core/dom/ElementData.cpp View 1 2 5 chunks +12 lines, -8 lines 0 comments Download
M Source/core/dom/Node.cpp View 1 2 chunks +4 lines, -2 lines 0 comments Download
M Source/core/html/HTMLEmbedElement.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/html/HTMLObjectElement.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/page/PageSerializer.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/xml/XPathStep.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/xml/parser/XMLDocumentParser.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 21 (0 generated)
Inactive
6 years, 10 months ago (2014-02-24 18:16:16 UTC) #1
esprehn
lgtm, we should probably just add an iterator someday instead. Can you add a comment ...
6 years, 10 months ago (2014-02-24 19:52:55 UTC) #2
Inactive
On 2014/02/24 19:52:55, esprehn wrote: > lgtm, we should probably just add an iterator someday ...
6 years, 10 months ago (2014-02-24 20:18:36 UTC) #3
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 10 months ago (2014-02-24 20:18:57 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/177613003/110001
6 years, 10 months ago (2014-02-24 20:19:07 UTC) #5
adamk
Agreed that the right way forward is to wrap this stuff in an iterator, it's ...
6 years, 10 months ago (2014-02-24 20:46:21 UTC) #6
Inactive
On 2014/02/24 20:46:21, adamk wrote: > Agreed that the right way forward is to wrap ...
6 years, 10 months ago (2014-02-24 20:50:57 UTC) #7
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-24 23:01:13 UTC) #8
commit-bot: I haz the power
Retried try job too often on mac_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_blink_rel&number=19731
6 years, 10 months ago (2014-02-24 23:01:14 UTC) #9
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 10 months ago (2014-02-24 23:24:44 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/177613003/110001
6 years, 10 months ago (2014-02-24 23:25:01 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/177613003/110001
6 years, 10 months ago (2014-02-25 01:09:09 UTC) #12
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-25 03:01:12 UTC) #13
commit-bot: I haz the power
Retried try job too often on mac_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_blink_rel&number=19779
6 years, 10 months ago (2014-02-25 03:01:13 UTC) #14
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 10 months ago (2014-02-25 03:08:54 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/177613003/110001
6 years, 10 months ago (2014-02-25 03:09:05 UTC) #16
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-25 04:53:13 UTC) #17
commit-bot: I haz the power
Retried try job too often on mac_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_blink_rel&number=19794
6 years, 10 months ago (2014-02-25 04:53:14 UTC) #18
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 10 months ago (2014-02-25 13:59:58 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/177613003/180001
6 years, 10 months ago (2014-02-25 14:00:20 UTC) #20
commit-bot: I haz the power
6 years, 10 months ago (2014-02-25 15:54:56 UTC) #21
Message was sent while issue was closed.
Change committed as 167794

Powered by Google App Engine
This is Rietveld 408576698