Subj : Re: Performance? To : netscape.public.mozilla.jseng From : Rickard Date : Fri Jun 20 2003 01:46 pm Igor Bukanov wrote: >> I'm using Rhino as a way to accomplish dynamic extensions (aka >> portlets) in our CMS, and also as a shell-type tool to access the system. >> >> Functionality wise everything is the way I want it to be, but the >> performance is a bit troubling. Most of the time we do 5-10 lines of >> code to get some data by calling services, then transforming it to be >> suitable for HTML output. What surprised me is that these small >> snippets can take about 100ms (and sometimes up to 500ms) to execute. >> >> I've tried all the usual suspects: doing a shared scope, calling >> setOptimizationLevel(9) (which made no difference at all), etc. > > You should call setOptimizationLevel(-1) to force pure interpreted mode. > In your case this is exactly what you need since this will avoid > creation and loading of Java classes which can be extremly slow. But, these scripts will run over and over again. Isn't it better to have them compiled in that case? Is the access of Java objects different depending on whether the script is compiled or not? Why would it be faster in the interpreted mode? I don't know how it works, but intuitively it seems like accessing Java objects from compiled JavaScript should be faster. What am I missing here? thanks, Rickard .