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
> --
> --
> v8-users mailing list
>
v8-u...@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+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.