We rely on Context.fromClass(clazz) which for compiled scripts will end up being ((ScriptLoader)clazz.getClassLoader()).getContext(), so not even a ThreadLocal.get() is needed; it should be quite light.
Attila. > On Nov 9, 2015, at 12:52 PM, Hannes Wallnoefer <hannes.wallnoe...@oracle.com> > wrote: > > +1 > > Could there be a performance impact of having the Context lookup in the > bootstrap method? Probably not, but I'm always a bit worried about (possibly > repeated) context lookups. > > Hannes > > > Am 2015-11-05 um 15:09 schrieb Attila Szegedi: >> Please review JDK-8141538 "Make DynamicLinker specific to a Context in >> Nashorn" at <http://cr.openjdk.java.net/~attila/8141538/webrev.jdk9> for >> <https://bugs.openjdk.java.net/browse/JDK-8141538> >> >> Thanks, >> Attila. >