[vlc-devel] vlc: svn commit r22946 (dionoea)
Antoine Cellerier
dionoea at videolan.org
Tue Nov 6 00:43:24 CET 2007
On Sun, Nov 04, 2007, Jean-Baptiste Kempf wrote:
> On Sun, Nov 04, 2007, Antoine Cellerier wrote:
> > * Trash the legacy C modules.
> Would that mean that you need lua to run the dummy interface?
That item was only meant to apply to the telnet, rc, hotkeys and, once
I'm done, http interface modules. The Lua interface dummy module doesn't
have much in common with the C interface dummy module other than its
name. It is only meant to be loaded when -I lua is used on the command
line without the --lua-intf option.
> Does that mean that you need lua to have the hotkeys to work?
If we decide to drop the C module, yes, you would need Lua to get
hotkeys to work.
> What is the overhead of using lua vs C ?
In terms of speed: the last comparison I read about mentioned Lua being
6 times slower than equivalent C code, altough that depends on what
kind of code[1] you're using to benchmark. If speed was a big issue, we
could use LuaJIT[2] (which adds 20 kB of code) to compile the Lua code
at runtime ... but I doubt that it'd be usefull for an interface, I'm
not planing on writing Lua codecs :p.
In terms of size: liblua5.1.so is 141 kB here, liblua_plugin.so is 65 kB
and each .lua file is about 20 kB (I don't know how much that is once the
lua_load function converts them to lua OP codes). In comparison,
librc_plugin.so is 45 kB, libtelnet_plugin.so is 14 kB and
libhotkeys_plugin.so is 22 kB. (Striped versions of the .so were used)
You'd then have to monitor memory usage at runtime, but I don't expect
the differences in that regards to be big anyway.
In terms of ease of programing and interface module maintenance: I
beleive that Lua wins, easily. You don't need to worry about memory
management, pointers, tedious string manipulation, etc[3].
Just in case anyone is wondering, Lua runs on far more platforms than
VLC does (and ever will). All you basically need is an ANSI C compiler
and a good old libc[3].
Of course I won't be forcing a switch to Lua. If we find out that this
isn't a good idea after all, we still have the C modules (well, I'd have
to rewrite the hotkeys module anyway).
I hope that this e-mail answers your questions,
References:
[1] http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=lua&lang2=gcc
[2] http://luajit.org/luajit_performance.html
[3] http://www.lua.org/about.html
--
Antoine Cellerier
dionoea
More information about the vlc-devel
mailing list