The currently supported optimization settings are:
Interpretive mode is always used. The compilation time is minimized at the expense of runtime performance. No class files are generated, which may improve memory usage depending on your system. Another benefit of the interpreted mode is that the interpreter performs tail-call elimination of recursive functions. Also, you must use this optimization level if your code uses Continuation objects.
If the optimization package is not available, then optimization acts as if it is always -1.
No optimizations are performed. The bytecode compiler runs fastest in this mode, but the generated byte code is less efficient.
- Some language features (indirect calls to eval, use of the arguments property of function objects) were previously not supported in higher optimization levels. These features have been removed from the language in ECMA, so higher optimization levels are now conformant.
- Future versions may allocate more aggressive optimizations to higher optimization levels. For compatibility with future versions, use level 1. For maximal optimization, use level 9, but retest your application when upgrading to new versions.
- Scripts are optimized at compile time, not at execution time. So if a Script is compiled with the context's optimizationLevel set to 1, it will be executed with those optimizations, regardless of the optimizationLevel of the context in which it is executed.