Moi + Affinity : Moi for 2D workflows

 From:  Michael Gibson
8629.50 In reply to 8629.48 
Hi Marco,

> If we simply take into account the "speed of execution" factor, can we state that the code
> executed inside a the "hmtl" page of a command or inside a script placed into the "scripts"
> folder, is faster (and many times faster) the the execution of "js code" present in the "js"
> counterpart of command's html ?

For V3 yes that's true - the .js code is run in a separate process and uses inter-process communication on every MoI API call. The reason for this is it makes it impossible for the script to freeze MoI if it runs in an endless loop or something like that, the worker process can be torn down independently from the script's cooperation.

But the inter-process communication has a performance penalty. The regular default commands in MoI never use script to do heavy calculations in loops or things like that, and so are ok with that.

Code in the HTML side runs in the main process thread and so it doesn't have that same overhead.

For V4 this will be different though, in V4 the .js script will be run on the main thread and not on a worker thread anymore and so in v4 there won't be any difference for which file the code is contained in.

- Michael