Closed
Bug 307600
Opened 19 years ago
Closed 19 years ago
Implement nsIContent::AttrHasValue
Categories
(Core :: DOM: Core & HTML, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
(Keywords: perf)
Attachments
(3 files, 2 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
We have a lot of places that GetAttr just to do comparisons on the value. These comparisons could be optimized if they were happening inside nsAttrValue in a lot of cases (with fallback to exactly the speed we have right now).
Assignee | ||
Comment 1•19 years ago
|
||
I'll start converting callers in followup bugs once we're happy with the API. In my testing, if the caller's type (string/atom) matches the callee's type for the attr this is about 3 times faster than a GetAttr/compare, while if the types don't match it's still about 30-40% faster.
Attachment #195348 -
Flags: superreview?(jst)
Attachment #195348 -
Flags: review?(jst)
Assignee | ||
Updated•19 years ago
|
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha
Comment 2•19 years ago
|
||
Comment on attachment 195348 [details] [diff] [review] Like so virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const = 0; + virtual PRBool AttrHasValue(PRInt32 aNameSpaceID, + nsIAtom* aName, + const nsAString& aValue, + PRBool aCaseSensitive) const + virtual PRBool AttrHasValue(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom* aValue, PRBool aCaseSensitive) const I was sort of thinking about naming these HasAttrWithValue(), but I'm not sure now which is better. r+sr=jst either way.
Attachment #195348 -
Flags: superreview?(jst)
Attachment #195348 -
Flags: superreview+
Attachment #195348 -
Flags: review?(jst)
Attachment #195348 -
Flags: review+
Assignee | ||
Comment 3•19 years ago
|
||
So... People suggested AttrValueIs or AttrIs. Shaver also objected to having PR_TRUE/PR_FALSE for the case and said separate methods would be better, but I couldn't think of any reasonably short names for the case-insensitive one. Using an enum instead of true/false was also suggested, but I really don't want to include nsIContent in nsAttrValue.h, and declaring two separate enums that just happen to share the same values seems fishy to me. jst? Thoughts?
Assignee | ||
Comment 4•19 years ago
|
||
Assignee | ||
Comment 5•19 years ago
|
||
Attachment #195673 -
Flags: superreview?(jst)
Attachment #195673 -
Flags: review?(jst)
Assignee | ||
Updated•19 years ago
|
Attachment #195673 -
Flags: superreview?(jst)
Attachment #195673 -
Flags: review?(jst)
Assignee | ||
Comment 6•19 years ago
|
||
Attachment #195673 -
Attachment is obsolete: true
Attachment #195676 -
Flags: superreview?(jst)
Attachment #195676 -
Flags: review?(jst)
Assignee | ||
Comment 7•19 years ago
|
||
Attachment #195348 -
Attachment is obsolete: true
Attachment #195708 -
Flags: superreview?(jst)
Attachment #195708 -
Flags: review?(jst)
Updated•19 years ago
|
Attachment #195676 -
Flags: superreview?(jst)
Attachment #195676 -
Flags: superreview+
Attachment #195676 -
Flags: review?(jst)
Attachment #195676 -
Flags: review+
Updated•19 years ago
|
Attachment #195708 -
Flags: superreview?(jst)
Attachment #195708 -
Flags: superreview+
Attachment #195708 -
Flags: review?(jst)
Attachment #195708 -
Flags: review+
Assignee | ||
Comment 8•19 years ago
|
||
Fixed. I'll file followup bugs on other places that can use these methods.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•