标准lua和luajit的一个代码测试对比

[root@localhost zl]# vim ./test_luajit_perf.lua 
[root@localhost zl]# time ./test_luajit_perf.lua 
10000001

real    0m0.019s
user    0m0.017s
sys     0m0.001s
[root@localhost zl]# 
[root@localhost zl]# 
[root@localhost zl]# time ./test_lua_perf.lua 
10000001

real    0m0.175s
user    0m0.174s
sys     0m0.001s


[root@localhost zl]# more test_luajit_perf.lua
#!/usr/local/bin/luajit
local i = 0
while 1 do 
   i = i+1
   if i > 10000000 then 
    print(i)
    break
  end
end
[root@localhost zl]# 
[root@localhost zl]# more test_lua_perf.lua
#!/usr/bin/lua
local i = 0
while 1 do 
   i = i+1
   if i > 10000000 then 
    print(i)
    break
  end
end
[root@localhost zl]#

你可能感兴趣的:(lua,开发语言)