Closed Bug 1824627 Opened 2 years ago Closed 2 years ago

Consider to have a larger cache for MiscContainer

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3-experiment])

Attachments

(1 file)

This would improve React-Stockcharts-SVG/ZoomTheChart/Sync a tiny bit.
It is the calling of malloc several times in a row (to fill the cache) which seems to help here.
The test creates lots of MiscContainers (>10000), so just increasing the size of the cache doesn't affect too much, since it would be empty all the time.

https://treeherder.mozilla.org/perfherder/comparesubtest?originalProject=try&newProject=try&newRevision=1a08f77cd113935a40d860941dddbf133dee4656&originalSignature=4586009&newSignature=4586009&framework=13&application=firefox&originalRevision=c36e3b3aa9c26348ef18303e5d07b069c89aaaf2&page=1&showOnlyConfident=1

if I remove the old cache https://searchfox.org/mozilla-central/rev/336ff5573f4b7aa8e981429093c051b3f78237ec/dom/base/nsAttrValue.h#563 stylo starts complaining about error[E0412]: cannot find type MiscContainer in module structs.
Error is coming from let container = ptr::structs::MiscContainer(attr);
What magic do I need to tell stylo about MiscContainer?

Flags: needinfo?(emilio)

This is one of those types we don't use in any FFI functions so bindgen doesn't generate them by default. Something like this should do tho:

diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp
index b4ce9a645971e..2a37dca7d7959 100644
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -144,7 +144,6 @@ void MiscContainer::Evict() {
 }
 
 nsTArray<const nsAttrValue::EnumTable*>* nsAttrValue::sEnumTableArray = nullptr;
-MiscContainer* nsAttrValue::sMiscContainerCache = nullptr;
 
 nsAttrValue::nsAttrValue() : mBits(0) {}
 
diff --git a/dom/base/nsAttrValue.h b/dom/base/nsAttrValue.h
index 2778d3f4819ba..6f5a572c421b8 100644
--- a/dom/base/nsAttrValue.h
+++ b/dom/base/nsAttrValue.h
@@ -560,7 +560,6 @@ class nsAttrValue {
   static void DeallocMiscContainer(MiscContainer* aCont);
 
   static nsTArray<const EnumTable*>* sEnumTableArray;
-  static MiscContainer* sMiscContainerCache;
 
   /**
    * Helper for ParseHTMLDimension and ParseNonzeroHTMLDimension.
diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml
index 0b8fe0e38bfb5..b33691847c5c6 100644
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -268,6 +268,7 @@ allowlist-types = [
     "mozilla::MediumFeaturesChangedResult",
     "nsAttrName",
     "nsAttrValue",
+    "MiscContainer",
     "nscolor",
     "nsChangeHint",
     "nsCSSCounterDesc",
Flags: needinfo?(emilio)
Attachment #9325092 - Attachment description: WIP: Bug 1824627 - Consider to have a larger cache for MiscContainer → WIP: Bug 1824627 - Consider to have a larger cache for MiscContainer, r=emilio
Attachment #9325092 - Attachment description: WIP: Bug 1824627 - Consider to have a larger cache for MiscContainer, r=emilio → Bug 1824627 - Consider to have a larger cache for MiscContainer, r=emilio
Pushed by opettay@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/de72d720a020 Consider to have a larger cache for MiscContainer, r=emilio
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: