static void Main(string[] args) { string[] scripts = new string[] { Path.GetFullPath(@"..\..\Scripts\Empty.lua"), Path.GetFullPath(@"..\..\Scripts\Sum.lua"), Path.GetFullPath(@"..\..\Scripts\Sum_strict{0}.lua"), Path.GetFullPath(@"..\..\Scripts\Sum_echo.lua"), Path.GetFullPath(@"..\..\Scripts\String.lua"), Path.GetFullPath(@"..\..\Scripts\String_echo.lua"), Path.GetFullPath(@"..\..\Scripts\Delegate.lua"), Path.GetFullPath(@"..\..\Scripts\StringBuilder{0}.lua"), Path.GetFullPath(@"..\..\Scripts\CallStd.lua"), Path.GetFullPath(@"..\..\Scripts\TableIntSet.lua"), Path.GetFullPath(@"..\..\Scripts\TableIntGet.lua"), Path.GetFullPath(@"..\..\Scripts\TableVsList{0}.lua"), Path.GetFullPath(@"..\..\Scripts\TableString.lua"), }; Console.WriteLine(); Console.WriteLine("Rebuild cache:"); for (int i = 0; i < scripts.Length; i++) { string sScript1 = File.ReadAllText(String.Format(scripts[i], 1)); string sScript2 = File.ReadAllText(String.Format(scripts[i], 2)); double t1 = ExecuteScriptLoop(ExecuteLuaIntf, sScript1, 100); double t2 = ExecuteScriptLoop(ExecuteNeoLua, sScript2, 100); Console.WriteLine(" {0,-20}: LuaInterface {1,6:N1} ms NeoLua {2,6:N1} ms {3,6:N3}", Path.GetFileNameWithoutExtension(scripts[i].Replace("{0}", "")), t1, t2, t2 == 0.0 ? Double.NaN : t1 / t2 ); } Console.WriteLine(); Console.WriteLine("Precompiled (no cache clear):"); debugNeoLua = null; for (int i = 0; i < scripts.Length; i++) { string sScript1 = File.ReadAllText(String.Format(scripts[i], 1)); string sScript2 = File.ReadAllText(String.Format(scripts[i], 2)); double t1 = ExecuteLuaIntfCompiled(sScript1, 100); double t2 = ExecuteNeoLuaCompiled(sScript2, 100); Console.WriteLine(" {0,-20}: LuaInterface {1,6:N1} ms NeoLua {2,6:N1} ms {3,6:N3}", Path.GetFileNameWithoutExtension(scripts[i].Replace("{0}", "")), t1, t2, t2 == 0.0 ? Double.NaN : t1 / t2 ); } Console.WriteLine(); Console.WriteLine("Precompiled (no cache clear, debug):"); debugNeoLua = Neo.IronLua.Lua.DefaultDebugEngine.DebugEngine; for (int i = 0; i < scripts.Length; i++) { string sScript1 = File.ReadAllText(String.Format(scripts[i], 1)); string sScript2 = File.ReadAllText(String.Format(scripts[i], 2)); double t1 = ExecuteLuaIntfCompiled(sScript1, 100); double t2 = ExecuteNeoLuaCompiled(sScript2, 100); Console.WriteLine(" {0,-20}: LuaInterface {1,6:N1} ms NeoLua {2,6:N1} ms {3,6:N3}", Path.GetFileNameWithoutExtension(scripts[i].Replace("{0}", "")), t1, t2, t2 == 0.0 ? Double.NaN : t1 / t2 ); } Console.WriteLine(); Console.WriteLine(v == 1801800 ? "All called." : String.Format("{0} != {1}", v, 1201200)); Console.ReadLine(); }
static void Main(string[] args) { string[] scripts = new string[] { Path.GetFullPath(@"..\..\Scripts\Empty.lua"), Path.GetFullPath(@"..\..\Scripts\Sum.lua"), Path.GetFullPath(@"..\..\Scripts\Sum_strict{0}.lua"), Path.GetFullPath(@"..\..\Scripts\Sum_echo.lua"), Path.GetFullPath(@"..\..\Scripts\String.lua"), Path.GetFullPath(@"..\..\Scripts\String_echo.lua"), Path.GetFullPath(@"..\..\Scripts\Delegate.lua"), Path.GetFullPath(@"..\..\Scripts\StringBuilder{0}.lua"), Path.GetFullPath(@"..\..\Scripts\CallStd.lua"), Path.GetFullPath(@"..\..\Scripts\TableIntSet.lua"), Path.GetFullPath(@"..\..\Scripts\TableIntGet.lua"), Path.GetFullPath(@"..\..\Scripts\TableVsList{0}.lua"), Path.GetFullPath(@"..\..\Scripts\TableString.lua"), }; Console.WriteLine(); Console.WriteLine("Rebuild cache:"); for (int i = 0; i < scripts.Length; i++) { string sScript1 = File.ReadAllText(String.Format(scripts[i], 1)); string sScript2 = File.ReadAllText(String.Format(scripts[i], 2)); double t1 = ExecuteScriptLoop(ExecuteLuaIntf, sScript1, 100); double t2 = ExecuteScriptLoop(ExecuteNeoLua, sScript2, 100); Console.WriteLine(" {0,-20}: LuaInterface {1,6:N1} ms NeoLua {2,6:N1} ms {3,6:N3}", Path.GetFileNameWithoutExtension(scripts[i].Replace("{0}", "")), t1, t2, t2 == 0.0 ? Double.NaN : t1 / t2 ); } Console.WriteLine(); Console.WriteLine("Precompiled (no cache clear):"); debugNeoLua = null; for (int i = 0; i < scripts.Length; i++) { string sScript1 = File.ReadAllText(String.Format(scripts[i], 1)); string sScript2 = File.ReadAllText(String.Format(scripts[i], 2)); double t1 = ExecuteLuaIntfCompiled(sScript1, 100); double t2 = ExecuteNeoLuaCompiled(sScript2, 100); Console.WriteLine(" {0,-20}: LuaInterface {1,6:N1} ms NeoLua {2,6:N1} ms {3,6:N3}", Path.GetFileNameWithoutExtension(scripts[i].Replace("{0}", "")), t1, t2, t2 == 0.0 ? Double.NaN : t1 / t2 ); } Console.WriteLine(); Console.WriteLine("Precompiled (no cache clear, debug):"); debugNeoLua = Neo.IronLua.Lua.DefaultDebugEngine.DebugEngine; for (int i = 0; i < scripts.Length; i++) { string sScript1 = File.ReadAllText(String.Format(scripts[i], 1)); string sScript2 = File.ReadAllText(String.Format(scripts[i], 2)); double t1 = ExecuteLuaIntfCompiled(sScript1, 100); double t2 = ExecuteNeoLuaCompiled(sScript2, 100); Console.WriteLine(" {0,-20}: LuaInterface {1,6:N1} ms NeoLua {2,6:N1} ms {3,6:N3}", Path.GetFileNameWithoutExtension(scripts[i].Replace("{0}", "")), t1, t2, t2 == 0.0 ? Double.NaN : t1 / t2 ); } Console.WriteLine(); Console.WriteLine(v == 1801800 ? "All called." : String.Format("{0} != {1}", v, 1201200)); Console.ReadLine(); }