A Lua performance guide for Lua and LuaJIT.
TODO:
- Add more cases for performance guide.
- Add test results for different platform, including x86 and ARM.
- Add English edition of performance guide.
- Original edition (in Chinese)
- English edition (working)
Runs lua main.lua run
env
, display lua environment of current interpreter, support official implemented lua and LuaJIT.list
, show all test cases included in code.run
, run test cases specified in arguments, it will run all cases while no cases is specified.
Write down your test codes in different functions, with no input argument, in a single module file.
At the end of the module file, returns a table including information of test, with 3 fields:
name
,[string]
name of this test suite, it MUST BE different from any other cases.desc
,[string]
description of test suite, ONLY used inlist
command,.cases
,[table]
an array of entries of test cases, including 2 fields:name
,[string]
name of this test case.entry
,[function]
, entry of test case.
Add name of test suite, which is filename of module lua file of test suite, directly pass to require function,
to index array, variable load_list
, found at the last of file src/init.lua
.
Run your test with main.lua
.
write your test suite.
function case_a()
-- some codes
end
function case_b()
-- some codes
end
return {
name = "example"
desc = "example of case."
cases = {
{ name = "case A", entry = case_a },
{ name = "case B", entry = case_b },
}
}
and add to 'src/init.lua'
--- a/src/init.lua
+++ b/src/init.lua
@@ -54,6 +54,7 @@ local load_list = {
"set-default-value",
"table-append",
"tail-recursion",
+ "example",
}