Bug 1853720 - Add a "hot" variant of AUTO_PROFILER_LABEL, for lower overhead when the profiler is disabled. r=aabh,profiler-reviewers

The overhead is showing up in Speedometer 3, especially in the innerHTML setter
when it calls into the frame constructor.

Full breakdown of callers across sp3 is here: https://share.firefox.dev/3rfckTG

Time spent in AutoProfilerLabel during TodoMVC-jQuery innerHTML:
Before: https://share.firefox.dev/3Znlydp 378 sampes
After: https://share.firefox.dev/45VdVgr 71 samples

Differential Revision: https://phabricator.services.mozilla.com/D188487
This commit is contained in:
Markus Stange
2023-09-25 19:36:41 +00:00
parent 1f94386ffb
commit 48895feea5
5 changed files with 96 additions and 31 deletions

View File

@@ -2607,8 +2607,8 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
}
nsIFrame* nsCSSFrameConstructor::ConstructRootFrame() {
AUTO_PROFILER_LABEL("nsCSSFrameConstructor::ConstructRootFrame",
LAYOUT_FrameConstruction);
AUTO_PROFILER_LABEL_HOT("nsCSSFrameConstructor::ConstructRootFrame",
LAYOUT_FrameConstruction);
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
ServoStyleSet* styleSet = mPresShell->StyleSet();
@@ -6491,8 +6491,8 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
MOZ_ASSERT(aInsertionKind == InsertionKind::Sync ||
!RestyleManager()->IsInStyleRefresh());
AUTO_PROFILER_LABEL("nsCSSFrameConstructor::ContentAppended",
LAYOUT_FrameConstruction);
AUTO_PROFILER_LABEL_HOT("nsCSSFrameConstructor::ContentAppended",
LAYOUT_FrameConstruction);
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
#ifdef DEBUG
@@ -6803,8 +6803,8 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild,
MOZ_ASSERT(aInsertionKind == InsertionKind::Sync ||
!RestyleManager()->IsInStyleRefresh());
AUTO_PROFILER_LABEL("nsCSSFrameConstructor::ContentRangeInserted",
LAYOUT_FrameConstruction);
AUTO_PROFILER_LABEL_HOT("nsCSSFrameConstructor::ContentRangeInserted",
LAYOUT_FrameConstruction);
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
MOZ_ASSERT(aStartChild, "must always pass a child");
@@ -7301,8 +7301,8 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
MOZ_ASSERT(aChild);
MOZ_ASSERT(!aChild->IsRootOfNativeAnonymousSubtree() || !aOldNextSibling,
"Anonymous roots don't have siblings");
AUTO_PROFILER_LABEL("nsCSSFrameConstructor::ContentRemoved",
LAYOUT_FrameConstruction);
AUTO_PROFILER_LABEL_HOT("nsCSSFrameConstructor::ContentRemoved",
LAYOUT_FrameConstruction);
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
nsPresContext* presContext = mPresShell->GetPresContext();
MOZ_ASSERT(presContext, "Our presShell should have a valid presContext");
@@ -7679,8 +7679,8 @@ bool nsCSSFrameConstructor::EnsureFrameForTextNodeIsCreatedAfterFlush(
void nsCSSFrameConstructor::CharacterDataChanged(
nsIContent* aContent, const CharacterDataChangeInfo& aInfo) {
AUTO_PROFILER_LABEL("nsCSSFrameConstructor::CharacterDataChanged",
LAYOUT_FrameConstruction);
AUTO_PROFILER_LABEL_HOT("nsCSSFrameConstructor::CharacterDataChanged",
LAYOUT_FrameConstruction);
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
if ((aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) &&