On Jan 23, 2005, at 8:52 AM, Darren Govoni wrote:
> =A0 I have a situation where I want to compartmentalize each script I=20=
> evaluate in an interpreter. Right now, I'm using a separate=20
> interpreter for each script. Is there a significant cost to doing=20
> this? The reason is that I set some variables on the interpreter that=20=
> are unique to each script and I don't want any co-mingling of these=20
> variables or access.
The interpreter is pretty lightweight... The main performance issue=20
would be the overhead of parsing a script repeatedly vs. keeping the=20
script parsed in the interpreter. (Check out: =20
http://beanshell.org/manual/parser.html#Parsing_and_Performance)
But if you're scripts don't write global variables that conflict, etc.=20=
then they should be able to live in one interpreter... just put them=20
into different method bodies or objects...
> =A0 What is the basic overhead cost of an interpreter? e.g. threads.
BeanShell doesn't start any threads of its own. It's pretty much what=20=
you see is what you get...
> Also, I have noticed a peculiar thing. In a callback method from my=20=
> application to a 'class' instantiated in beanshell and exposed to the=20=
> Java app, some variables will not access properly WITHOUT a class=20
> declaration. The script just halts when you try to access, without a=20=
> runtime exception. I'm using the latest beta jar of BSH and JDK1.5_01.
Hmm... I'm not sure that I understand exactly. On a regular bsh=20
object you'd need to use the getVariable() method... Are you saying=20
that that doesn't return?
Pat
|