Last Comment Bug 819489 - [Shutdown] Style sheet take ~50ms to release during shutdown
: [Shutdown] Style sheet take ~50ms to release during shutdown
Status: NEW
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: x86 Mac OS X
-- normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
Depends on: 691216
Blocks: shutdown-faster
  Show dependency treegraph
Reported: 2012-12-07 11:55 PST by Benoit Girard (:BenWa)
Modified: 2014-08-09 08:02 PDT (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Time spent (1.45 KB, text/plain)
2013-03-11 20:29 PDT, Benoit Girard (:BenWa)
no flags Details

Description User image Benoit Girard (:BenWa) 2012-12-07 11:55:34 PST
Profiles report:

This currently list 10 shutdown profiles sorted from longest to shortest time spent in nsCSSStyleSheet::~nsCSSStyleSheet recorded on my system. Click on the profile will preview the profile + highlight the function.

Looks like a lot of the time is spent in free and related memory management function.
Comment 1 User image Boris Zbarsky [:bz] (still a bit busy) 2012-12-07 12:05:51 PST
This isn't object model stuff; this is basic style system data structures...

We've got free() calls for all the rules, their declarations, the selector linked lists (one free per node), the arrays stored in CSSDeclaration, and the various heap-allocated things hanging out in nsCSSValues. :(
Comment 2 User image :Ehsan Akhgari 2012-12-07 12:10:05 PST
Can we allocate that stuff from arenas?

/me takes off the arenas-solve-everything hat
Comment 3 User image Boris Zbarsky [:bz] (still a bit busy) 2012-12-07 12:29:24 PST
We can try.  That does get into lifetime + CSSOM + DOM issues a bit.  :(
Comment 4 User image David Baron :dbaron: ⌚️UTC-8 2012-12-07 23:37:43 PST
bug 691216 would also help here.
Comment 5 User image Benoit Girard (:BenWa) 2013-03-11 20:29:49 PDT
Created attachment 723791 [details]
Time spent

I have been receiving several profiles lately where there's over 1 second spent in this function. Here's the heavy leaf attach and a profile here:
Note the resolution is 10ms
Comment 6 User image Andrew McCreight [:mccr8] 2014-05-26 20:38:58 PDT
For what its worth, I've seen large CC pauses caused by the destructor for nsCSSStyleSheet (multiple ms for a single one) in bug 861449, and it was caused entirely by clearing arrays of Rules with thousands of elements.  For the CC pauses, this is easy enough to fix by switching over to a runnable that incrementally destroys the arrays, but of course that won't help with shutdown.

Note You need to log in before you can comment on or make changes to this bug.