scriptEngine optimization