Although I have not spent much time yet on performance issues or optimizations,
I did recently look at two baseline cases: an empty loop and an empty eval()
(equivalent to a call from Java).
In the latest release I've made some changes in ordering the way variables
and class names are resolved. The new behavior is more correct in terms of
java compatibility and also appears to be much faster, especially with respect
The empty loop is about twice as fast now.
The eval() test uncovered some inexplicably bad behavior in earlier releases
and has improved dramatically. Using 1.1a6 the performance degraded seriously
with the number of iterations. With 1.1a7 it is flat and much much faster.
I am guessing something was abusing the garbage collector in previous releases,
but I do not know precisely what.
One further oddity - I notice that the jdk1.2.2 that comes with Solaris
is at least twice as fast as the latest/greatest jdk1.3_02. Perhaps the 1.3
download is not optimized yet on Solaris?
-- Test Results --
// empty loop, 10000 iterations, java 1.2.2
1.1a6 3.2 sec
1.1a7 1.5 sec
The test is a loop with an empty eval("") statement in it.
// bsh-1.1a6.jar, eval.bsh, java 1.2.2 (time in ms)
count: 10 time: 20
count: 25 time: 9
count: 50 time: 12
count: 75 time: 17
count: 100 time: 22
count: 200 time: 39
count: 300 time: 56
count: 400 time: 73
count: 500 time: 90
// bsh-1.1a7.jar, eval.bsh, java 1.2.2 (time in ms)
count: 10 time: 15
count: 25 time: 4
count: 50 time: 5
count: 75 time: 4
count: 100 time: 4
count: 200 time: 3
count: 300 time: 3
count: 400 time: 3
count: 500 time: 3
count: 1000 time: 3
count: 2000 time: 3
count: 3000 time: 3
count: 5000 time: 3
count: 10000 time: 3
1.1a7 is available on http://www.beanshell.org