Closed Bug 1430951 Opened 6 years ago Closed 6 years ago

Avoid element name atomizing to improve performance of LookupCustomElementDefinition

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

Attachments

(1 file)

From profile [1] in bug 1396575 comment #9, I found we spend some time atomizing aLocalName when looking up definition [2]. And the caller usually pass nodeInfo->LocalName() as aLocalName, like [3]. It looks like we could use nodeInfo->NameAtom() given that these codes are only called with element's nodeInfo which the LocalName() and NameAtom() should be the same value [4].

[1] https://perf-html.io/public/708b78ee5c83e942269ea6b20795464b61337624/calltree/?hiddenThreads=&invertCallstack&range=2.6524_2.7236&thread=5&threadOrder=0-2-3-4-5-1&transforms=f-combined-xAi-i&v=2
[2] https://searchfox.org/mozilla-central/rev/41925c0b6c6d58578690121de439d2a8d3d690f3/dom/base/CustomElementRegistry.cpp#290
[3] https://searchfox.org/mozilla-central/rev/41925c0b6c6d58578690121de439d2a8d3d690f3/dom/base/nsContentUtils.cpp#10012
[4] https://searchfox.org/mozilla-central/rev/48cbb200aa027a0a379b6004b6196a167344b865/dom/base/NodeInfo.cpp#79,89
Blocks: 1396575
Attachment #8943142 - Flags: review?(bugs)
Comment on attachment 8943142 [details]
Bug 1430951 - Avoid element name atomizing to improve performance of LookupCustomElementDefinition;

https://reviewboard.mozilla.org/r/213432/#review219336

::: dom/base/nsContentUtils.cpp:9926
(Diff revision 1)
>    NodeInfo* nodeInfo = aElement->NodeInfo();
>    RefPtr<nsAtom> typeAtom =
>      aElement->GetCustomElementData()->GetCustomElementType();
>    CustomElementDefinition* definition =
>      nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
> -                                                  nodeInfo->LocalName(),
> +                                                  nodeInfo->NameAtom(),

Could you assert somewhere here that
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeIno->LocalName()))
Attachment #8943142 - Flags: review?(bugs) → review+
Comment on attachment 8943142 [details]
Bug 1430951 - Avoid element name atomizing to improve performance of LookupCustomElementDefinition;

https://reviewboard.mozilla.org/r/213432/#review219336

> Could you assert somewhere here that
> MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeIno->LocalName()))

Will do.
Pushed by top12345tw@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/53d7ccf627fa
Avoid element name atomizing to improve performance of LookupCustomElementDefinition; r=smaug
https://hg.mozilla.org/mozilla-central/rev/53d7ccf627fa
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: