Tu devrais faire du Lua

Pierre Chapuis, Moodstocks

Tu devrais faire du

Lua

Human Talks Paris, 12/02/2013

Qui c'est celui-là ?

Pierre Chapuis, Moodstocks

Transparents: http://is.gd/luaht (CC BY 3.0)

Attention

trollface

Lu- quoi?

[1] J'avais prévenu...

Léger ?

~ 100 ko cœur + 100 ko stdlib, 4 ko RAM

200 ko

Simple ?

Lua is much simpler than JS. This means you can make a simple interpreter that runs fast enough to be balanced with respect to the trace-JITted code.

Brendan Eich

LuaJIT : rapide !

bench

1 cœur 64 bits, mai 2010 :(

Pas de bibliothèques ? :(

no libraries

LuaJIT : FFI

      
local ffi = require("ffi")
ffi.cdef[[
unsigned long compressBound(unsigned long sourceLen);
int compress2(uint8_t *dest, unsigned long *destLen,
    const uint8_t *source, unsigned long sourceLen, int level);
]]
local zlib = ffi.load("z")

local compress = function(txt)
  local n = zlib.compressBound(#txt)
  local buf = ffi.new("uint8_t[?]", n)
  local buflen = ffi.new("unsigned long[1]", n)
  assert(zlib.compress2(buf, buflen, txt, #txt, 9) == 0)
  return ffi.string(buf, buflen[0])
end

local txt = string.rep("abcd", 1000)
local c = compress(txt)
      
    

Usage : jeux

Angry Birds, Cry Engine 2 (Crysis), World of Warcraft, L.A. Noire, Baldur's Gate, Heroes of Might & Magic V...

tropico

Usage : jeux

monkey island

Usage : mobile

Autres usages

VLC, Adobe Lightroom, Awesome WM (Kindle Touch), Redis, Luvit / LUV, nginx, nmap, wireshark, SnabbSwitch, NetBSD, Codea, Roblox...

Autres usages

milkymist

Autres usages

eluabrain

Aller plus loin

books

C'était qui, déjà ?

Pierre Chapuis, Moodstocks

Transparents: http://is.gd/luaht (CC BY 3.0)