Closed Bug 254373 Opened 21 years ago Closed 21 years ago

[FIX]nsHTMLSelectElement::GetOptionIndex is slow

Categories

(Core :: DOM: Core & HTML, defect, P2)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha3

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: perf)

Attachments

(1 file)

This method is doing a lot of COM and QI stuff that's really unnecessary... it should just be pushed down to where we don't have to worry about all that.
Attached patch Like soSplinter Review
Comment on attachment 155234 [details] [diff] [review] Like so I considered just doing indexof and comparing its return to aStartIndex, taking into account aForward, but then I decide maybe caller knows enough to be passing "almost right" start indices.... (the only caller that passes a nonzero start index and/or an aForward that's false is XBL form controls anyway).
Attachment #155234 - Flags: superreview?(peterv)
Attachment #155234 - Flags: review?(peterv)
Blocks: 183918
Keywords: perf
Priority: -- → P2
Summary: nsHTMLSelectElement::GetOptionIndex is slow → [FIX]nsHTMLSelectElement::GetOptionIndex is slow
Target Milestone: --- → mozilla1.8alpha3
Comment on attachment 155234 [details] [diff] [review] Like so >+nsHTMLOptionCollection::GetOptionIndex(nsIDOMHTMLOptionElement* aOption, >+ PRInt32 high = mElements.Count(); >+ PRInt32 low = -1; >+ PRInt32 step = aForward ? 1 : -1; >+ >+ for (index = aStartIndex; index < high && index > low; index += step) { You don't really need low, just use index > -1
Attachment #155234 - Flags: superreview?(peterv)
Attachment #155234 - Flags: superreview+
Attachment #155234 - Flags: review?(peterv)
Attachment #155234 - Flags: review+
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: