Object.freeze() on prototype

John Bernardo jbernardo at linkedin.com
Tue Oct 28 23:38:35 UTC 2014


Hi,

We’re currently working on getting Nashorn to a usable state in our production environment and currently focusing on improving performance to reach an acceptable state before rollout.

Right now, we’re using ScriptEngine.eval() on the script source to set up the JS environment to prevent leaks into the global context. Instead of doing this, one idea we’ve been thinking about is using Object.freeze() on our global boilerplate and passing that around to each ScriptEngine instance we create (one per thread), which could potentially save performance.

Is this approach safe? Is there a better/more performant way to achieve a common context? Please advise.

JDK = 1_8_0_5

- JB


More information about the nashorn-dev mailing list