runtimejs / runtime

[not maintained] Lightweight JavaScript library operating system for the cloud
http://runtimejs.org
Apache License 2.0
1.93k stars 128 forks source link

AOT compiling #6

Closed ir-g closed 10 years ago

ir-g commented 10 years ago

Would AOT/compilation be planned for runtimejs? I would find it a great feature for an iteration of JS.

iefserge commented 10 years ago

Runtimejs uses V8 to compile JavaScript. And as far as I know, V8 doesn't support AOT compilation and it is purely a just-in-time compiler. So, I don't think it's possible at the moment.

RangerMauve commented 10 years ago

I know that Node provides the vm module which allows you to precompile code, but AFAIK it's not any more performant than just using it at runtime.

ir-g commented 10 years ago

@iefserge @RangerMauve I was thinking that it could be beneficial for making compiled server applications possible, meaning that software could be made and relesed in binary-only form.

RangerMauve commented 10 years ago

@isaacrg Precomiling might be nice if you don't want your source code to be visible, but it does come at a performance loss, and the actual JIT is pretty fast.

Might want to look at the first answer here.

ir-g commented 10 years ago

Note: AOT is not always the slower option - where AOT compiling is performed on the chosen device, it can be quicker.

groundwater commented 10 years ago

@RangerMauve the node VM module compiles code into the current context. It's a slightly better version of eval. It does not actually compile your code into a serialized format.