Closed Bug 1237714 Opened 8 years ago Closed 8 years ago

nsContentUtils::IsCustomElementName is slower than it should be

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

It's doing 2 checks like so:

2779   if (NS_FAILED(nsContentUtils::CheckQName(str, false, &colon)) || colon ||
2780       str.FindChar('-') == -1) {
2781     return false;

but in practice the CheckQName() call will always return success, there will almost never be a colon and there will almost never be a '-'.  So why aren't we checking for the '-' first and skipping the expensive CheckQName call in the common case of there being no '-'?
Blocks: 1232023
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
I did check that this makes IsCustomElementName almost disappear from my profile in bug 1232023.
Attachment #8705468 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/8fc13f4bc59e
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
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: