Thanks for the clarifications, Jakob.

On Tue, Nov 11, 2014 at 1:40 AM, Jakob Kummerow <jkumme...@chromium.org> wrote:
> mksnapshot isn't intended for creating arbitrary snapshots, that's why it's
> not exposed or documented. You are of course free to play around with it,
> but you're pretty much on your own.
>
> For the record, Chrome does not create a Chrome-specific V8 snapshot
> (AFAIK).
>
> Also, bear in mind that putting stuff into the snapshot is a tradeoff:
> extracting things from the snapshot is (usually) faster than
> parsing/compiling them from source, but on the other hand extracting a
> bigger snapshot is obviously slower than extracting a smaller snapshot. So
> V8 tries very carefully to only put the most important bits into the
> snapshot, rather than anything that might potentially be used at some point.
>
> On Tue, Nov 11, 2014 at 7:29 AM, Louis Santillan <lpsan...@gmail.com> wrote:
>>
>> So if I'm reading the qt doc [0] and src/mksnapshot.cc [1] correctly,
>> mksnapshot expects to be run like something like
>>
>> ./mksnapshot [optional v8 engine args] mystartup.js mysnapshot.cc
>>
>> where mystartup.js is a JS file that runs without error.  I would
>> expect mystartup.js to be a significant enough part of your app that
>> you can measure its compilation during startup.  It should also be
>> composed of the "common" part of your app; the part of your app that
>> must run as a prerequisite for all execution paths.  For v8, that
>> means it uses mksnapshot to build the JS built-in objects into the
>> runtime startup of itself (a sort bootstrapping technique).  It's a
>> process that takes less than 5 ms on an Intel(R) Xeon(R) CPU E3-1240
>> V2 @ 3.40GHz.  I would imagine it's a lot more beneficial in
>> Chrome/Chromium where DOM and a bunch of UI, network, crypto, etc.,
>> takes multiple MBs to load.
>>
>> Where this gets interesting is when your mystartup.js depends on
>> Native objects or Native code not built-in to v8 or JS built-ins.
>> mksnapshot does not seem to take this into account.  However, it
>> appears, that if you modify src/mksnapshot.cc somewhere after here [2]
>> but before [3], then your mystartup.js *CAN* depend (and compile
>> against) Native code just as is done in samples/shell.cc [4] to load
>> the print/read/load/quit/version Native code.  You'll have to rebuild
>> v8 and you'll have to get your source tree co-mingled with v8's
>> tree/build process, but such is life.
>>
>> [0] http://qt-project.org/wiki/V8Snapshot
>> [1] https://github.com/v8/v8/blob/master/src/mksnapshot.cc
>> [2]
>> https://github.com/v8/v8/blob/134ebca3d871784966ea068d06210d9fe70ec4ab/src/mksnapshot.cc#L370
>> [3]
>> https://github.com/v8/v8/blob/134ebca3d871784966ea068d06210d9fe70ec4ab/src/mksnapshot.cc#L395
>> [4]
>> https://github.com/v8/v8/blob/134ebca3d871784966ea068d06210d9fe70ec4ab/samples/shell.cc#L96
>>
>> On Mon, Nov 10, 2014 at 7:06 PM, Flying Jester <foolkingcr...@gmail.com>
>> wrote:
>> > Snapshots are enabled all the time unless you expressly disable them
>> > with
>> > gyp.
>> >
>> >
>> > On Monday, November 10, 2014 4:59:37 PM UTC-9, Chris E wrote:
>> >>
>> >> Hello all,
>> >>
>> >> I am trying to use v8 snapshots to improve the start-up time of a v8
>> >> application (like what chrome/chromium does), but I am unable to find
>> >> sufficient documentation to understand and use this feature.
>> >>
>> >> I have looked at the following references, but it is still not clear to
>> >> me
>> >> exactly how to make the best use of snapshots for performance.
>> >> https://developers.google.com/v8/embed
>> >> http://qt-project.org/wiki/V8Snapshot
>> >>
>> >> The QT link seemed the most useful so can anyone verify the correctness
>> >> of
>> >> this reference?
>> >>
>> >> So basically we have to compile and run our JS application with an
>> >> emulator and somehow generate the  snapshot.cc using mksnapshot?
>> >> If our JS application is large and has many features, how do we know
>> >> how
>> >> much of it should run before creating the snapshot?
>> >> How is this snapshot affected by libraries (both C++ and JS) that get
>> >> loaded dynamically?
>> >>
>> >> Also it sounds like we have to be careful that the snapshot is not
>> >> 'stale'
>> >> or outdated with respect to the code that we run to create the snapshot
>> >> right?
>> >>
>> >> Thank you so much for the help and clarifications.
>> >
>> > --
>> > --
>> > 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.
>>
>> --
>> --
>> 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.
>
>
> --
> --
> 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.

-- 
-- 
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