What can we do about the negative performance impact this is having on chrome extensions?-Darin
On Tue, Sep 22, 2009 at 12:57 PM, Erik Corry <[email protected]> wrote: > > > 2009/9/22 Matt Perry <[email protected]> > >> First, my question: what is the reason for the call >> to i::Heap::CollectAllGarbageIfContextDisposed() in v8::Context::New? Is it >> just a heuristic that can be removed? Or can we maybe add an API to disable >> this in some cases? >> > > It's a heuristic. The idea is that when you navigate to a new page you > will destroy a series of contexts (one per iframe) and then create a new > context for the new main page. This is a good time to GC because it helps > clear up the DOM nodes from the old page. > > >> >> The Chrome extension system introduces a feature called content scripts, >> which allows you to run scripts in a new Context with a handle to the DOM >> window of a target frame. The way this is implemented seems to trigger a >> pathological case in v8::Context::New, causing more GCs than necessary. >> >> What happens is that content scripts create short-lived Contexts, where we >> create the Context, run some script, and immediately Dispose of it. The call >> to Dispose sets a flag in v8 which causes the next call to v8::Context::New >> to trigger a GC. This means that any time 2+ content scripts are run in a >> given process, we do a GC, slowing down page load. >> >> You can see the effect of running 50 content scripts on Chrome's startup >> here: >> http://build.chromium.org/buildbot/perf/xp-release/startup/report.html?history=20 >> (the >> top green line). If I comment out the call >> to i::Heap::CollectAllGarbageIfContextDisposed(), the startup time for that >> test is cut in half. >> >> >> > > > -- > Erik Corry, Software Engineer > Google Denmark ApS. CVR nr. 28 86 69 84 > c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018 Copenhagen > K, Denmark. > > > > > --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
