public void testInvoke() throws Exception {
eng = new ScriptEngineManager().getEngineByName("jav8");
Compilable compiler = (Compilable) this.eng;
CompiledScript script = compiler.compile(calcFunction);
int max = 100000;
Bindings binding = this.eng.getBindings(ScriptContext.GLOBAL_SCOPE);
binding.put("num", 3);
Object r = script.eval(binding);
System.out.println(r);
long startM = System.currentTimeMillis();
for ( int i=0; i<max; i++ ) {
script.eval(binding);
}
long endM = System.currentTimeMillis();
System.out.println(" V8 engine loop " + max + ":" + (endM-startM));
}
V8EngineTest.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:gameserver
作者:
评论列表
文章目录