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

New Post: Some basic compiled script questions

0
0
Hello Eric,

I would like to cache my compiled scripts, but it seems from what I've read in the discussions that the compiled scripts are associated with a particular V8 runtime instance. Is that simply a V8 limitation?

Yes. A compiled script is bound to the V8 runtime that created it. There's no cross-runtime script representation that performs better than plain-text JavaScript.

Well, actually, there could be. V8 also supports precompilation, which generates reusable offline data that speeds up compilation, but (a) ClearScript currently doesn't support it, and (b) it would still require per-runtime compilation.

In that case I would have to create a managed V8 engine pool with each engine having an associated script cache (which obviously detracts from the benefits of the cache).

A couple of points: The main benefit of a compiled script is enhanced performance for repeated execution. If a script is likely to be run multiple times in multiple runtimes, it makes sense to compile and cache it for each runtime unless you're memory-constrained. Also, depending on your requirements, it might make sense to share runtimes across engine instances, which would greatly reduce memory usage and enable compiled script sharing at the cost of reduced concurrency.

Good luck!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images