WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
16478
Redundant isElement checks in NodeLists
https://bugs.webkit.org/show_bug.cgi?id=16478
Summary
Redundant isElement checks in NodeLists
David Smith
Reported
2007-12-17 11:00:58 PST
A small (0.6-1.6% on one test I made) speedup for getElementsByClassName is possible by removing what appears to be a redundant check of testNode->isElement in nodeMatches. A similar check exists in TagNodeList, but not other subclasses of NodeList. Searching for nodeMatches project-wide in WebCore turns up four callsites, three of which have their own isElement checks, and the last of which uses getElementByID to get the node. olliej suggested putting an ASSERT in instead of a check, so as to make sure that no future callsites accidentally leave out the isElement check.
Attachments
Patch. Passes run-webkit-tests
(2.70 KB, patch)
2007-12-17 11:03 PST
,
David Smith
eric
: review-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
David Smith
Comment 1
2007-12-17 11:03:10 PST
Created
attachment 17966
[details]
Patch. Passes run-webkit-tests
Darin Adler
Comment 2
2007-12-17 11:33:27 PST
Comment on
attachment 17966
[details]
Patch. Passes run-webkit-tests If the parameters are really guaranteed to be Element, then the function's signature needs to change to Element* -- the patch is fine, but doesn't go far enough.
David Smith
Comment 3
2007-12-17 13:19:15 PST
(In reply to
comment #2
)
> (From update of
attachment 17966
[details]
[edit]) > If the parameters are really guaranteed to be Element, then the function's > signature needs to change to Element* -- the patch is fine, but doesn't go far > enough. >
It seemed odd/bad to me to be declaring stuff that takes an Element* in Node.h. Is this not a problem?
Eric Seidel (no email)
Comment 4
2007-12-17 14:22:26 PST
Comment on
attachment 17966
[details]
Patch. Passes run-webkit-tests It makes little sense to me to have an ASSERT for a specific subclass when the method signature expects the base class. The better way to change this is to change the message signature, and then the callers to static_cast when necessary.
David Smith
Comment 5
2008-10-23 01:15:30 PDT
This was fixed at some point.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug