On Wed, Jun 3, 2015 at 7:11 AM, Jane Chen <jxche...@gmail.com> wrote:
> I have global variables and global functions exposed through object
> templates and function templates, which slows down context creation.  I
> wonder whether I could still leverage the custom snapshot feature to speed
> up context creation with any of the following two approaches:
>
> 1) With the recent v8::V8::CreateSnapshotDataBlob introduced since V8 4.3
> 2) With the mechanism implemented in mksnapshot in 3.x by capturing a
> snapshot with a global object containing functions with callbacks, and later
> using that to initialize v8.
>
> Thanks in advance.

If your question is if there is a mechanism to serialize
FunctionTemplates and ObjectTemplates, I'm 95% sure that hasn't been
implemented (yet - I believe it has been talked about.)

Have you tried caching your FunctionTemplates and ObjectTemplates?
You don't have to instantiate them afresh for each new context, you
can reuse them.

If you are worried about the overhead of
FunctionTemplate::GetFunction(), you may want to experiment with using
ObjectTemplate::SetAccessor() on your global object's ObjectTemplate
(the one you pass to Context::New()) to lazily instantiate them.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to