Hi Erik,

>From v8's guide, it said that using snapshot will greatly speed the first
creation of context. Will it also boost the later call to
v8::context::New()?

2010/12/8 Erik Corry <[email protected]>

> 4. dec. 2010 17.56 skrev hua ye <[email protected]>:
> > Hi Kasper,
> >
> > Yes, we use the old version. I checked the new v8 source and the full GC
> is
> > removed from creating new context.
> > Thanks for the reminder.
> >
> > Then I have other questions?
> > 1. It seems that without GC creating context will be faster, but, I
> wonder
> > if it just moved the cost from here to other places.
>
> Having fewer GCs will almost always be faster, but of course it will
> tend to use more memory.
>
> There's an idle callback in the API that you can use to tell V8 that
> now would be a good time to do GC.
>
> > 2. What's the reason to remove GC from creating new context?
>
> As you noticed it slows down creating a new context. :-)
>
> The reason it was there is that new contexts are often created after
> several old contexts have been disposed and it can be good to do a GC
> after disposal of a context because it is a time when a lot of garbage
> can be collected.
>
> > 3. Where can I get the benchmark data between different v8 versions?
>
> We sometimes publish benchmark data for the whole browser on the
> Chromium blog, but I don't think we ever published anythink like the
> data you are asking about.
>
>
> > Kenny
> >
> > 2010/12/4 Kasper Lund <[email protected]>
> >>
> >> Hua ye,
> >>
> >> Which version of V8 are you using? The current version of V8 does not
> >> invoke the garbage collector when creating new contexts and it hasn't
> >> since r4003 which was submitted in early March, 2010.
> >>
> >> Cheers,
> >> Kasper
> >>
> >> On Sat, Dec 4, 2010 at 6:05 AM, hua ye <[email protected]> wrote:
> >> > Dears,
> >> >
> >> > Is there any way to boost the speed of v8 GC?
> >> > From my profiling when v8 creates a new context, it will execute a
> >> > full GC if the old context is disposed. The full GC costs most of the
> >> > time.
> >> >
> >> > Is there any idea to boost this, the following is my profiling result:
> >> >
> >> > Persistent<Context> v8::Context::New(
> >> >    v8::ExtensionConfiguration* extensions,
> >> >    v8::Handle<ObjectTemplate> global_template,
> >> >    v8::Handle<Value> global_object) {
> >> >  EnsureInitialized("v8::Context::New()");
> >> >  LOG_API("Context::New");
> >> >  ON_BAILOUT("v8::Context::New()", return Persistent<Context>());
> >> >
> >> >  // Enter V8 via an ENTER_V8 scope.
> >> >  i::Handle<i::Context> env;
> >> >  {
> >> >    ENTER_V8;
> >> > #if defined(ANDROID)
> >> >    // On mobile device, full GC is expensive, leave it to the system
> >> > to
> >> >    // decide when should make a full GC.
> >> > #else
> >> >    // Give the heap a chance to cleanup if we've disposed contexts.
> >> >
> >> > i::Heap::CollectAllGarbageIfContextDisposed();
> >> >        //
> >> > ******** Most of the time here
> >> > #endif
> >> >
> >> >   ......
> >> >    ......
> >> >    ......
> >> >
> >> >    // Create the environment.
> >> >    env =
> >> > i::Bootstrapper::CreateEnvironment(
>  //%%%%
> >> > % create environment costs also too much time
> >> >        Utils::OpenHandle(*global_object),
> >> >        proxy_template,
> >> >        extensions);
> >> >
> >> >    // Restore the access check info on the global template.
> >> >    if (!global_template.IsEmpty()) {
> >> >      ASSERT(!global_constructor.is_null());
> >> >      ASSERT(!proxy_constructor.is_null());
> >> >      global_constructor->set_access_check_info(
> >> >          proxy_constructor->access_check_info());
> >> >      global_constructor->set_needs_access_check(
> >> >          proxy_constructor->needs_access_check());
> >> >    }
> >> >  }
> >> >  // Leave V8.
> >> >
> >> >  if (env.is_null())
> >> >    return Persistent<Context>();
> >> >  return Persistent<Context>(Utils::ToLocal(env));
> >> > }
> >> >
> >> > --
> >> > v8-users mailing list
> >> > [email protected]
> >> > http://groups.google.com/group/v8-users
> >> >
> >>
> >> --
> >> v8-users mailing list
> >> [email protected]
> >> http://groups.google.com/group/v8-users
> >
> > --
> > v8-users mailing list
> > [email protected]
> > http://groups.google.com/group/v8-users
>
>
>
> --
> Erik Corry, Software Engineer
> Google Denmark ApS - Frederiksborggade 20B, 1 sal,
> 1360 København K - Denmark - CVR nr. 28 86 69 84
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to