Skip to content

Discussion/Tracking SnapshotCreator support #13877

Closed
@bmeck

Description

@bmeck

Relevant earlier discussion on #9473 .

v8::SnapshotCreator is a means to capture a heap snapshot of JS, CodeGen, and C++ bindings and revive them w/o performing loading/evaluation steps that got to there. This issue is discussing what would be needed for tools like webpack which run many times and have significant startup cost need in order to utilize snapshots.

CC: @hashseed @refack

  • All C++ bindings available as intptr_t
  • C++ addon API/declaration to register external intptr_ts
  • CLI flags for --make-snapshot and --from-snapshot
  • JS API to declare main() functions for snapshots (save to v8::Private::ForApi($main_symbol_name)).
  • JS API to declare vm.Context for snapshot
  • Serializer for
    • ArrayBuffer/TypedArrays
    • HandleWrap
    • ObjectWrap
    • Timer
    • STDIO
    • require.cache paths?
  • File format for snapshots
    • C++ Addon inlining / symlinking

The v8 API might be able to have some changes made (LANDED)

Right now the v8 API would need a --make-snapshot CLI flag since v8::SnapshotCreator controls Isolate creation and node would need to use the created isolate.

Since all JS handles need to be closed when creating the snapshot, a main() function would need to be declared during snapshot creation after all possible preloading has occurred. The snapshot could then be taken when node exits if exiting normally (note, unref'd handles may still exist).

Some utility like WarmUpSnapshotDataBlob from v8 so that the JIT code is warm when loaded off disk also relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussIssues opened for discussions and feedbacks.lib / srcIssues and PRs related to general changes in the lib or src directory.performanceIssues and PRs related to the performance of Node.js.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions