Skip to content

lvzixun/lvmjit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lvmjit

compilation lua fucntion during execution of lua program at run time.

tutorail

local lvmjit = require "lvmjit.core"

local function func(...)
    -- do something..
end

local cfunc = lvmjit.compile(func)
cfunc(...)

benchmark

test lua case in test.lua in my 3 GHz Intel Core i7 CPU

local function foo(a, b)
    local sum = a + b
    local d = 1
    for i=1,400000000 do
        sum = sum + d
    end
    return sum
end
type cost up
origin lua5.4 2.63411s 0%
lvmjit lua5.4 1.950952s 25.94%

support opcode

opcode status
OP_MOVE YES
OP_LOADI YES
OP_RETURN0 YES
OP_RETURN1 YES
OP_RETURN YES
OP_ADD YES
OP_FORPREP YES
OP_FORLOOP YES
OP_LOADK YES
OTHER OPCODE NO

linux platform

instead LUAI_FUNC macro extern of __attribute__((visibility("internal"))) extern in luaconf.h.

About

compile lua fucntion to computer code just in time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published