Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Using Compile with Execute and Script

0
0
Hi johnsev,

Do first compile the script then execute the script?

Yes, that's correct. Note that compiling a script only makes sense if you need to execute it more than once in a given V8 runtime. If you re-execute a script only when it changes, compiling it provides no benefit.

Also, consider what the script actually does. If all it does is define a script function and invoke it, there's no need to re-execute it, as you can invoke an existing script function as many times as necessary. The main goal is to avoid redundant use of the script parser/compiler, as it's relatively slow.

Good luck!

Viewing all articles
Browse latest Browse all 2297