On Aug 25, 2008, at 1:50 AM, Nathan wrote:
> Hi,
>
> I've just upgraded from 1.5R4 to 1.7R1 and some scripts that used to
> compile now no longer compile.
>
> My code is pretty much as follows:
>
> context.setGeneratingDebug( true );
> context.setOptimizationLevel( 0 );
> this.script = context.compileReader( reader, fileName, 1, null );
>
> Then I call a function multiple times on the same script, throwing the
> scope away after each execution:
>
> Scriptable scope = new ImporterTopLevel();
> this.script.exec( context, scope );
> Object functionObject = scope.get( functionName, scope );
> if ( functionObject instanceof Function )
> {
> Function function = (Function)functionObject;
> function.call( context, scope, null, args );
> }
>
> The first question is whether this usage is acceptable. I want to
> reuse the compiled code to save perm gen space and compilation time.
> I need to throw away the scope between executions to save heap space
> between function calls.
Hm... an initStandardObjects() in every created scope might be in
order. *Or* running it in a single scope that's then being set as the
prototype of the newly created scopes. Other than that, yes, it's fine.
Attila.
--
home: http://www.szegedi.org
weblog: http://constc.blogspot.com
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino