diff --git a/src/script/org/luaj/jit/LuaJit.java b/src/script/org/luaj/jit/LuaJit.java index 178ad242..9d76c1c8 100644 --- a/src/script/org/luaj/jit/LuaJit.java +++ b/src/script/org/luaj/jit/LuaJit.java @@ -93,6 +93,15 @@ public class LuaJit extends Lua implements LuaCompiler { // instantiate, config and return if (success) { + // compile sub-prototypes + if ( p.p != null ) { + for ( int i=0, n=p.p.length; i 0) { // else use previous instruction set top for ( int j=1; j 0 ) for ( int j=0; j 0) { for ( int j=1; j plain ); + } + + private static int timeTrial(String type, LPrototype p) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseLib.redirectOutput(outputStream); + LuaState vm = Platform.newLuaState(); + LClosure c = p.newClosure(vm._G); + int globalCount = 0; + for ( int i=0; i<5; i++ ) { + int localCount = 0; + long t1 = System.currentTimeMillis() + 1000; + while ( t1 > System.currentTimeMillis() ) { + vm.pushlvalue(c); + vm.call(0, 0); + localCount++; + } + System.out.println(type+": "+(localCount)); + System.out.flush(); + globalCount += localCount; + } + return globalCount; + } +}