Bug 77845 - Use Element's hasName/hasID flags to avoid unnecessary work when looking up name/id attributes.
Summary: Use Element's hasName/hasID flags to avoid unnecessary work when looking up n...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-05 20:17 PST by Andreas Kling
Modified: 2012-02-11 06:50 PST (History)
6 users (show)

See Also:


Attachments
Patch (7.36 KB, patch)
2012-02-05 20:17 PST, Andreas Kling
ggaren: review+
Details | Formatted Diff | Diff
Patch v2 (21.29 KB, patch)
2012-02-11 05:58 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2012-02-05 20:17:01 PST
HTMLCollection: Use Element's hasName/hasID flags to avoid unnecessary work.
Comment 1 Andreas Kling 2012-02-05 20:17:52 PST
Created attachment 125557 [details]
Patch
Comment 2 Geoffrey Garen 2012-02-08 08:46:39 PST
Comment on attachment 125557 [details]
Patch

This patch makes me think the following refactoring would be a good idea:

(1) Change getIdAttribute() to check hasID() for you;
(2) Add a getNameAttribute() that works just like getIdAttribute().

Now, as long as you use these functions when getting name and/or id, everything is fast, and you remove a lot of the code you've introduced in this patch.
Comment 3 Andreas Kling 2012-02-11 05:58:01 PST
Created attachment 126631 [details]
Patch v2

Better patch with getIdAttribute() and getNameAttribute() as suggested by Geoff.
Comment 4 Andreas Kling 2012-02-11 06:50:36 PST
Comment on attachment 126631 [details]
Patch v2

Clearing flags on attachment: 126631

Committed r107477: <http://trac.webkit.org/changeset/107477>
Comment 5 Andreas Kling 2012-02-11 06:50:45 PST
All reviewed patches have been landed.  Closing bug.