Skip to content

Instantly share code, notes, and snippets.

View SUP2Ak's full-sized avatar
➡️
https://discord.gg/B6Z5VbA5wd

Wesley SUP2Ak

➡️
https://discord.gg/B6Z5VbA5wd
View GitHub Profile

LuaJIT FFI layout benchmark — code & numbers

I decided to run a proper benchmark to see how these patterns actually behave under the hood. Tested on Windows x64 (LuaJIT 2.1) with process isolation and ASM inspection. (Full disclosure: I was too lazy to boot into Linux for this, even though perf and jit.v support is admittedly better over there, but the results are clear enough.

Each of the 5 base layouts is tested in two equivalent semantics:

  • br = branchful: if active then x += vx end
  • nbr = branchless: x += vx * active

With active ∈ {true/1, false/0} both produce identical output.

@SUP2Ak
SUP2Ak / server.lua
Last active October 20, 2024 01:40
Wipe Player (ESX)
-- Use lua54 in your fxmanifest
local function DeleteRowByIdentifier(identifier, by)
local dbName = MySQL.scalar.await('SELECT DATABASE()')
local t = MySQL.query.await(('SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ("owner", "identifier") AND TABLE_SCHEMA = "%s"'):format(dbName))
local queries = {}
if t == '[]' or #t < 1 then return end
for i = 1, #t do
@SUP2Ak
SUP2Ak / fxmanifest.lua
Last active December 8, 2023 21:33
[FiveM] EasyLoader RageUI v2
-- IN RAGEUI FOLDER
-- DANS VOTRE DOSSIER RAGEUI
-- Replace your fxmanifest with that
-- Remplacer votre fxmanifest par ceci
fx_version 'cerulean'
game 'gta5'
lua54 'yes'