Is lua called from redis interpretted or compiled?
Asked Answered
C

1

7

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?

Canonry answered 1/4, 2015 at 12:59 Comment(1)
What do you believe the difference between those two would be in this case? What question are you really trying to ask?Culley
H
7

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.

Hayott answered 1/4, 2015 at 13:35 Comment(3)
Here intro2libsys.info/introduction-to-redis/lua-scripting it is written that redis has a lua interpreter. Does it mean that when redis makes a call to execute a lua script, it is interpretted and not compiled?Canonry
Redis wraps your script into a function and uses luaL_loadbuffer as you can see here.Teuton
Good to know actually! And the compilation should be done only once as you send only SHA1 for next lua calls.Phaidra

© 2022 - 2024 — McMap. All rights reserved.