I found CPU usage can only reach to 60% or so (a machine with 4 CPUs),
if I start four threads running following code:
Context cx = Context.enter();
Scriptable scope = cx.initStandardObjects();
try
{
for (int i=0; i<100000000; i++)
{
Script script = cx.compileString( "new Date()",
null, 0, null );
script.exec( cx, scope );
}
}
finally
{
Context.exit();
}
However, CPU usage just jump to 100%, if I move cx.compileString( "new
Date()", null, 0, null ) out of the loop,
It seems that the scripts compiling has threads contention issue.
Could anybody tell me the reason? Why? Where is the root cause?
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino