Too many system compartments at start-up

2014-03-21 Thread Nicholas Nethercote
Hi, At start-up, with a new profile, Firefox creates more than 230 system compartments. This is about 90 more than a year ago, and it's part of the reason why Firefox uses almost twice as much physical memory at start-up than it did two years ago. (Have a look at https://areweslimyet.com/ for the

Re: Too many system compartments at start-up

2014-03-21 Thread Gregory Szorc
Could someone please provide an update on reducing compartment overhead? Are we at a point where things like services/healthreport/HealthReport.jsm should be considered a necessary evil rather than a gross hack? What other solutions besides concatenating files and lazy loading are there?

Re: Intent to ship: CSS.escape

2014-03-21 Thread Boris Zbarsky
On 3/20/14 12:11 PM, Anne van Kesteren wrote: Seems fine, specification should probably clarify surrogate handling. I would expect a paired surrogate in JavaScript to end up as a single escape. Non-ASCII stuff is OK in CSS idents, so it doesn't need escaping at all: it's just left as-is.

Re: Too many system compartments at start-up

2014-03-21 Thread Nicholas Nethercote
On Fri, Mar 21, 2014 at 12:16 AM, Gregory Szorc g...@mozilla.com wrote: Could someone please provide an update on reducing compartment overhead? Are we at a point where things like services/healthreport/HealthReport.jsm should be considered a necessary evil rather than a gross hack? What

Re: Too many system compartments at start-up

2014-03-21 Thread Benjamin Smedberg
On 3/21/2014 2:46 AM, Nicholas Nethercote wrote: Hi, At start-up, with a new profile, Firefox creates more than 230 system compartments. This is about 90 more than a year ago, and it's part of the reason why Firefox uses almost twice as much physical memory at start-up than it did two years

Re: Too many system compartments at start-up

2014-03-21 Thread Robert Kaiser
Nicholas Nethercote schrieb: Hi, At start-up, with a new profile, Firefox creates more than 230 system compartments. This is about 90 more than a year ago, and it's part of the reason why Firefox uses almost twice as much physical memory at start-up than it did two years ago. Hrm, reading

Re: Should nsIPrefBranch.set*Pref return NS_ERROR_UNEXPECTED on type mismatch?

2014-03-21 Thread Irving Reid
On 2014-03-20 5:03 PM, Neil wrote: Irving Reid wrote: For unknown reasons, internal bookkeeping prefs used by AddonManager and XPIProvider are set to values of the wrong type on some Firefox profiles, and are now stuck that way. I can write wrapper code on these calls to catch the error and

Re: Too many system compartments at start-up

2014-03-21 Thread Marco Bonardo
I started filing some low-hanging-fruit dependencies, though, looks like one of the main culprit is modules that are Cu.import-ed instead of defineLazyModuleGetter-ed. I wonder if we could somehow instrument Cu.import so that if a module is not used before N seconds (or M ticks?) from when it

Re: Too many system compartments at start-up

2014-03-21 Thread Benjamin Smedberg
On 3/21/2014 10:34 AM, Marco Bonardo wrote: Or directly make Cu.import act like defineLazyModuleGetter... Would that be possible? I don't think that's a good idea. It's not an uncommon pattern to try/catch around a module import in case it's not present in a particular configuration or the

Re: Should nsIPrefBranch.set*Pref return NS_ERROR_UNEXPECTED on type mismatch?

2014-03-21 Thread Irving Reid
On 2014-03-20 5:38 PM, Gavin Sharp wrote: On Thu, Mar 20, 2014 at 10:38 AM, Irving Reid irv...@mozilla.com wrote: For unknown reasons, internal bookkeeping prefs used by AddonManager and XPIProvider are set to values of the wrong type on some Firefox profiles, and are now stuck that way. I can

Re: Too many system compartments at start-up

2014-03-21 Thread Marco Bonardo
On 21/03/2014 15:37, Benjamin Smedberg wrote: On 3/21/2014 10:34 AM, Marco Bonardo wrote: Or directly make Cu.import act like defineLazyModuleGetter... Would that be possible? I don't think that's a good idea. It's not an uncommon pattern to try/catch around a module import in case it's not

Re: Too many system compartments at start-up

2014-03-21 Thread Bobby Holley
On Fri, Mar 21, 2014 at 10:31 AM, Benjamin Smedberg benja...@smedbergs.uswrote: On 3/21/2014 2:46 AM, Nicholas Nethercote wrote: Hi, At start-up, with a new profile, Firefox creates more than 230 system compartments. This is about 90 more than a year ago, and it's part of the reason why

Re: Intent to ship: CSS.escape

2014-03-21 Thread Simon Pieters
On Thu, 20 Mar 2014 17:11:01 +0100, Anne van Kesteren ann...@annevk.nl wrote: On Thu, Mar 20, 2014 at 3:17 PM, Boris Zbarsky bzbar...@mit.edu wrote: http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method which allows web pages to create a valid CSS identifier that will parse to a given

Re: Too many system compartments at start-up

2014-03-21 Thread Gregory Szorc
On 3/21/14, 1:37 AM, Nicholas Nethercote wrote: On Fri, Mar 21, 2014 at 12:16 AM, Gregory Szorc g...@mozilla.com wrote: Could someone please provide an update on reducing compartment overhead? Are we at a point where things like services/healthreport/HealthReport.jsm should be considered a

Re: Too many system compartments at start-up

2014-03-21 Thread Bill McCloskey
- Original Message - From: Gregory Szorc g...@mozilla.com To: Nicholas Nethercote n.netherc...@gmail.com Cc: dev-platform dev-platform@lists.mozilla.org Sent: Friday, March 21, 2014 9:27:34 AM Subject: Re: Too many system compartments at start-up Also, the bug I was referring to is

Re: Too many system compartments at start-up

2014-03-21 Thread Boris Zbarsky
On 3/21/14 11:02 AM, Bobby Holley wrote: I'm also curious to hear about the overhead of compartments now that we have zones. An important question: which of these system compartments actually share a zone with each other? I know the goal is all of them, but are we actually getting there?

Re: Too many system compartments at start-up

2014-03-21 Thread Gregory Szorc
On 3/21/14, 9:36 AM, Bill McCloskey wrote: - Original Message - From: Gregory Szorc g...@mozilla.com To: Nicholas Nethercote n.netherc...@gmail.com Cc: dev-platform dev-platform@lists.mozilla.org Sent: Friday, March 21, 2014 9:27:34 AM Subject: Re: Too many system compartments at

Re: Too many system compartments at start-up

2014-03-21 Thread Gregory Szorc
On 3/21/14, 9:06 AM, Bill McCloskey wrote: - Original Message - From: Bobby Holley bobbyhol...@gmail.com To: Benjamin Smedberg benja...@smedbergs.us Cc: dev-platform dev-platform@lists.mozilla.org, Nicholas Nethercote n.netherc...@gmail.com Sent: Friday, March 21, 2014 8:02:58 AM

Re: Should nsIPrefBranch.set*Pref return NS_ERROR_UNEXPECTED on type mismatch?

2014-03-21 Thread Gavin Sharp
On Fri, Mar 21, 2014 at 7:40 AM, Irving Reid irv...@mozilla.com wrote: extensions.blocklist.pingCountVersion (146 times out of ~1.5 million Nightly telemetry sessions) and extensions.shownSelectionUI (8 times in 1.5m) The prefs in question aren't likely targets for malware, though they could

Re: Too many system compartments at start-up

2014-03-21 Thread Bobby Holley
On Fri, Mar 21, 2014 at 1:37 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 3/21/14 11:02 AM, Bobby Holley wrote: I'm also curious to hear about the overhead of compartments now that we have zones. An important question: which of these system compartments actually share a zone with each

Re: Too many system compartments at start-up

2014-03-21 Thread Boris Zbarsky
On 3/21/14 1:09 PM, Bobby Holley wrote: For JSMs and stuff, they should all go into the system zone. I realize that, emphasis on should. Have we verified that this is happening? -Boris ___ dev-platform mailing list dev-platform@lists.mozilla.org

Re: Too many system compartments at start-up

2014-03-21 Thread Andrew Sutherland
On 03/21/2014 12:06 PM, Bill McCloskey wrote: The problem with doing measurements is that the per-compartment overhead is very dependent on what's going on in the compartment. I tried to enable the B2G compartment merging stuff in desktop Firefox to get a sense of how much of a change there

Re: Too many system compartments at start-up

2014-03-21 Thread Bobby Holley
On Fri, Mar 21, 2014 at 2:23 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 3/21/14 1:09 PM, Bobby Holley wrote: For JSMs and stuff, they should all go into the system zone. I realize that, emphasis on should. Have we verified that this is happening? Maybe bill did, at some point? This is

Re: Too many system compartments at start-up

2014-03-21 Thread Andrew McCreight
Looking at a recent AWSY run, in StartSettled, I see three non-window zones. One is about 22mb and contains all the stuff you'd expect, browser.xul, various .jsm files etc. The second is is 2.8mb, almost entirely strings. There's one string that is about 10,000 long, but the rest are

Re: Running b2g reftests on mozilla-inbound on EC2 instances

2014-03-21 Thread Armen Zambrano G.
We're now running b2g reftests on EC2 on every trunk branch side-by-side with the Fedora minis: https://tbpl.mozilla.org/?jobname=b2g_emulator.*reftest They're running around 30-40% slower. We are looking at enabling them on faster EC2 instances so we can disable the minis. regards, Armen On

Re: Running b2g reftests on mozilla-inbound on EC2 instances

2014-03-21 Thread Armen Zambrano G.
We're now running b2g reftests on EC2 on every trunk branch side-by-side with the Fedora minis: https://tbpl.mozilla.org/?jobname=b2g_emulator.*reftest They're running around 30-40% slower. We are looking at enabling them on faster EC2 instances so we can disable the minis. regards, Armen On

Re: Too many system compartments at start-up

2014-03-21 Thread Bobby Holley
On Fri, Mar 21, 2014 at 2:45 PM, Andrew McCreight amccrei...@mozilla.comwrote: Looking at a recent AWSY run, in StartSettled, I see three non-window zones. One is about 22mb and contains all the stuff you'd expect, browser.xul, various .jsm files etc. The second is is 2.8mb, almost

Re: Too many system compartments at start-up

2014-03-21 Thread Nicholas Nethercote
On Fri, Mar 21, 2014 at 6:31 AM, Benjamin Smedberg benja...@smedbergs.us wrote: What is the per-compartment overhead? It's hard to pin an exact number on it. It depends on exactly the mixture of GC things allocated by the compartment. But in my current session, the smallest two system

Re: Too many system compartments at start-up

2014-03-21 Thread Bill McCloskey
- Original Message - From: Nicholas Nethercote n.netherc...@gmail.com To: Benjamin Smedberg benja...@smedbergs.us Cc: dev-platform dev-platform@lists.mozilla.org Sent: Friday, March 21, 2014 2:00:01 PM Subject: Re: Too many system compartments at start-up Marco identified a number

Re: Too many system compartments at start-up

2014-03-21 Thread Nicholas Nethercote
On Fri, Mar 21, 2014 at 2:00 PM, Nicholas Nethercote n.netherc...@gmail.com wrote: What is the per-compartment overhead? It's hard to pin an exact number on it. It depends on exactly the mixture of GC things allocated by the compartment. But in my current session, the smallest two system

Re: Memory management in features implemented in JS

2014-03-21 Thread Jim Blandy
On 03/19/2014 04:39 PM, Kyle Huey wrote: Short of not implementing things in JS, what ideas do people have for fixing these issues? We have some ideas of how to add helpers to scope these things to the lifetime of the window (perhaps by adding an API that returns a promise that is resolved at

Re: Memory management in features implemented in JS

2014-03-21 Thread Jim Blandy
On 03/21/2014 03:34 PM, Jim Blandy wrote: What if these DOM nodes could use a special class of observers / listeners that automatically set themselves aside when the node is deleted from the document, and re-instate themselves if the node is re-inserted in the document? Similarly for when the

Re: Memory management in features implemented in JS

2014-03-21 Thread Boris Zbarsky
On 3/21/14 6:34 PM, Jim Blandy wrote: What if these DOM nodes I don't believe there are any DOM nodes involved in the situation that Kyle described at the start of this thread... -Boris ___ dev-platform mailing list dev-platform@lists.mozilla.org

Re: Memory management in features implemented in JS

2014-03-21 Thread Jim Blandy
On 03/21/2014 05:03 PM, Boris Zbarsky wrote: On 3/21/14 6:34 PM, Jim Blandy wrote: I don't believe there are any DOM nodes involved in the situation that Kyle described at the start of this thread... It's true that when I read, We are discovering a lot of leaks in JS implemented DOM objects,

Re: Should nsIPrefBranch.set*Pref return NS_ERROR_UNEXPECTED on type mismatch?

2014-03-21 Thread L. David Baron
On Thursday 2014-03-20 13:38 -0400, Irving Reid wrote: In a way we're dancing around competing footguns here - do we protect against bad code trying to break our preferences by setting a value to the wrong type, or do we protect against a broken preference messing up our code because we can't

Re: Memory management in features implemented in JS

2014-03-21 Thread K. Gadd
In many cases the point at which an object becomes uninteresting is the point at which it is unreachable, and no deterministically identifiable point before that. It is true that in many cases you don't need anything resembling weak references, and can simply manually mark objects as dead. There

Re: Memory management in features implemented in JS

2014-03-21 Thread Jason Orendorff
On 3/21/14, 10:23 PM, K. Gadd wrote: A hypothetical scenario (please ignore any minor detail errors, I'm using this to illustrate the scenario): Let's say I have a main document and it spawns 3 popup windows as documents. The popup windows have references to the parent document and use them to