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