Closed Bug 1407096 Opened 7 years ago Closed 7 years ago

stylo-blocklist: measure the performance impact for enabling the blocklist mechanism

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox58 --- affected

People

(Reporter: chenpighead, Assigned: chenpighead)

References

Details

During the stylo team meeting today, Bobby mentioned that we could probably do some profiling to measure the impact of introducing the blocklist mechanism (in Bug 1403077).

I wonder if there's a representative try syntax that I could refer to? So, I can push some try runs to compare the performance with difference stylo blocklist prefs.
You can just put some number of entries in the blocklist, and use the gecko profiler to measure time spent opening example.com or something. See how many entries need to be in the blocklist before the performance hit becomes measurable.
Ok, here are the steps that I've done for the performance measurement:

1. restart gecko profiler
2. open a new tab and get to amazon.com
3. click couple links near the top of the amazon.com home page and open each of them in a new tab, and switch to the newly opened tab
3.1 open "Your Amazon.com"
3.2 open "Today's Deals"
3.3 open "Gift Cards & Registry"
3.4 open "Sell"
3.5 open "Help"
4. stop capturing and open the profile
5. search for "UpdateStyleBackendType" in each process's call stack


I repeated steps 1-5 with different entries in the blocklist, start from 100, 200, 400, 800, ...etc.
I can't get any result until I added 2000 entries in the blocklist, a 1ms call is finally sampled.

IIUC, we shouldn't have entries more than 10~20, so I think the performance is not affected.
Resolve this bug accordingly.


By the way, for anyone who might be interested in the call stack, the call is from cycle collection, which calles Element::UnbindFromTree() and goes to here [1]. It seems that the caller tries to unbind an node that has mozilla::StyleBackendType::None, so a lazily update, i.e., nsIDocument::UpdateStyleBackendType() is called.


[1] https://searchfox.org/mozilla-central/rev/1a4a26905f923458679a59a4be1e455ebc53c333/dom/base/Element.cpp#1920
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
(In reply to Jeremy Chen [:jeremychen] UTC+8 from comment #2)
> By the way, for anyone who might be interested in the call stack, the call
> is from cycle collection, which calles Element::UnbindFromTree() and goes to
> here [1]. It seems that the caller tries to unbind an node that has
> mozilla::StyleBackendType::None, so a lazily update, i.e.,
> nsIDocument::UpdateStyleBackendType() is called.
> 
> 
> [1]
> https://searchfox.org/mozilla-central/rev/
> 1a4a26905f923458679a59a4be1e455ebc53c333/dom/base/Element.cpp#1920

Hmm, it's slightly wasteful to compute the style backend and then attempt to clear the element data from the node, if we never styled the document.  But I guess it's not a big deal.
You need to log in before you can comment on or make changes to this bug.