Add JIT optimization booster shot

This commit is contained in:
Rerumu 2021-11-27 03:14:01 -05:00
parent 504e2e0ee8
commit 820588b5e7

View File

@ -2,6 +2,7 @@ local module = {}
local bit = require('bit') local bit = require('bit')
local ffi = require('ffi') local ffi = require('ffi')
local jit = require('jit')
local u32 = ffi.typeof('uint32_t') local u32 = ffi.typeof('uint32_t')
local u64 = ffi.typeof('uint64_t') local u64 = ffi.typeof('uint64_t')
@ -16,6 +17,8 @@ typedef union {
} Reinterpret; } Reinterpret;
]] ]]
if jit and jit.opt then jit.opt.start("maxsnap=1000", "loopunroll=500", "maxmcode=2048") end
local function truncate(num) local function truncate(num)
if num >= 0 then if num >= 0 then
return math.floor(num) return math.floor(num)