Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is lua called from redis interpretted or compiled?

Redis supports lua scripting. Using eval command, we can execute a lua script in redis. Is the lua script compiled or interpretted when redis calls a lua script?

like image 459
Ridhima Avatar asked Apr 01 '15 12:04

Ridhima


People also ask

Is Lua compiled or interpreted?

Lua is not directly interpreted through a Lua file like other languages such as Python. Instead, it uses the Lua interpreter to compile a Lua file to bytecode. The Lua interpreter is written in ANSI C, making it highly portable and capable of running on a multitude of devices.

What Lua does Redis use?

Presently, Redis supports a single scripting engine, the Lua 5.1 interpreter.

Is Lua compiled to C?

Lua is implemented in pure ANSI C and compiles unmodified in all known platforms. All you need to build Lua is an ANSI C compiler (gcc and clang are a popular ones). Lua also compiles cleanly as C++.

Is Lua script Atomic?

Lua scripts are executed atomically, that is, no other script or command will run while a script is running, which gives us the same transactional semantics as MULTI / EXEC .


1 Answers

Lua scripts sent to the Lua library for execution are always compiled to Lua VM instructions before execution. These instructions are then interpreted by the Lua VM.

like image 181
lhf Avatar answered Oct 17 '22 16:10

lhf