How to reuse VIT JIT optimization in subsequent Node launches?

I intend to run node somefile.js several times.

Presumably every time I run this file using Node, it will JIT-compile the script and perform other optimizations.

Unfortunately: every time a performance ends, he will forget all the work he has done.

Do I have a way to save the optimization that V8 created from a previous run and apply them to a subsequent run?

+4
source share
1 answer

Saving / loading compiled code for v8 is complicated and rarely justified, because there is much more information to save than simple compiled code, and because it takes a little time to optimize and compile v8 (well, there’s also a warm-up, but also the total time to run optimized code is rarely large).

So, in mainline v8 there is nothing you ask for.

However, you can specify the --always-opt option on v8, as well as a way to force a specific function to be set up on the next call. You should only do this if your function is stable.

+4
source

All Articles