src: enable context snapshot after running per-context scripts · nodejs/node@228127f · GitHub
Skip to content

Commit 228127f

Browse files
joyeecheungtargos
authored andcommitted
src: enable context snapshot after running per-context scripts
At build time, snapshot the context after running per-context scripts in the main instance, and in the final build, deserialize the context in the main instance. This provides a ~5% in the misc/startup benchmark when the instance is launched within a process that runs test/fixtures/semicolon.js. PR-URL: #27321 Refs: #17058 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 45d6106 commit 228127f

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/node_main_instance.cc

Lines changed: 5 additions & 1 deletion

src/node_main_instance.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class NodeMainInstance {
7575
static const IndexArray* GetIsolateDataIndexes();
7676
static v8::StartupData* GetEmbeddedSnapshotBlob();
7777

78+
static const size_t kNodeContextIndex = 0;
79+
7880
private:
7981
NodeMainInstance(const NodeMainInstance&) = delete;
8082
NodeMainInstance& operator=(const NodeMainInstance&) = delete;

tools/snapshot/snapshot_builder.cc

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)