for ( ; ii < 10000; ii++)
print ("after the loop:" + ii);
This is quite a bit slower in BeanShell than in other programs.
Looking at the source code, I suspect that the problem is not
in the loop but in variable handling. Specifically the follwing:
private Object consumeNextObjectField( Interpreter interpreter )
Is it a class name?
If we're just starting eval of name (and it wasn't a variable
reference per above) try to make it, else fail.
Class names are attempted before long variable chains because
we don't have any way to "back out" if we start down a chain
and we're wrong. In general this seems ok.
So each time ii is looked at BeanShell checks to see if it's a class or
a variable, and that takes time.
Log in to post a comment.