mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-28 00:59:31 +00:00
LuaJIT compatibility
Spoiler alert: Anselme run ~1.5x slower in LuaJIT than Lua 5.3/5.4. I didn't expected LuaJIT to be able to optimize anything with my super performant and cache friendly AST walker interpreter, but being this much slower is kinda impressive.
This commit is contained in:
parent
82ce53be83
commit
809613ef8b
8 changed files with 27 additions and 6 deletions
21
anselme.lua
21
anselme.lua
|
|
@ -43,11 +43,16 @@
|
|||
-- end
|
||||
-- ```
|
||||
|
||||
local parser = require("parser")
|
||||
local State = require("state.State")
|
||||
require("ast.abstract.Node"):_i_hate_cycles()
|
||||
-- LuaJIT compatibility
|
||||
-- TODO: too heavyhanded
|
||||
if _VERSION == "Lua 5.1" then
|
||||
package.path = "./?/init.lua;" .. package.path
|
||||
table.unpack = unpack
|
||||
end
|
||||
|
||||
return {
|
||||
local parser, State
|
||||
|
||||
local anselme = {
|
||||
--- Global version string. Follow semver.
|
||||
version = "2.0.0-alpha",
|
||||
|
||||
|
|
@ -78,3 +83,11 @@ return {
|
|||
return State:new()
|
||||
end,
|
||||
}
|
||||
|
||||
package.loaded[...] = anselme
|
||||
|
||||
parser = require("parser")
|
||||
State = require("state.State")
|
||||
require("ast.abstract.Node"):_i_hate_cycles()
|
||||
|
||||
return anselme
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue