I've been using this lately on a personal project. For those who don't know, this is basically a clone of the Node.js API in the Lua language (using the LuaJIT compiler). This is interesting because: - LuaJIT is often faster than V8 and uses less memory - LuaJIT has a built in C FFI and supports C datatypes for working with low level libraries (or even writing low level code in Lua) - Lua has coroutines I think this…
Luvit – Asynchronous I/O for Lua
11–20 of 37 posts
Re: Luvit – Asynchronous I/O for Lua
#12Not sure exactly how duped this is for HN... For those that don't know.. Lua is a scripting language, perhaps a bit more structured than it's more popular counterparts (JavaScript and Python), having very good performance characteristics. It's very popular in terms of Game development. Luvit is essentially a lua interpreter with bindings to libuv (the same core IO library used in NodeJS). And could mainly be consider…
> Lua is a scripting language, perhaps a bit more structured than it's more popular counterparts (JavaScript and Python) I wouldn't say it has more structure than Python or JavaScript. Lua has only these types: number, string, boolean, table, function, nil, userdata and thread. Table acts as a hybrid between list and map, just like Array/Object in JavaScript. And users rarely are exposed directly to userdata/thread,…
Re: Luvit – Asynchronous I/O for Lua
#13For those interested, lthread now supports AIO. It's still in dev branch, but I'll be merging it soon: http://webmon.com/blog/2013/02/19/lthread-now-supports-userl... https://github.com/halayli/lthread/blob/dev/src/lthread_io.c
digressing from luvit... how does the stack copying technique (as used in lthread) compare to segmented stacks (as used in go)? The swap technique is very simple but I would assume that the stack copy shows up in profiles and is significantly slower than the segmented stack technique... Are there any benchmarks?
Re: Luvit – Asynchronous I/O for Lua
#14I've been using this lately on a personal project. For those who don't know, this is basically a clone of the Node.js API in the Lua language (using the LuaJIT compiler). This is interesting because: - LuaJIT is often faster than V8 and uses less memory - LuaJIT has a built in C FFI and supports C datatypes for working with low level libraries (or even writing low level code in Lua) - Lua has coroutines I think this…
I think Rackspace is using openresty. http://openresty.org/
Luvit.io is specifically being used in our Host Monitoring Agent, which is open source and you can find here:
https://github.com/racker/virgo
This is used to collect all kinds of host metrics (CPU, disk, ram, custom scripts, mysql, etc) for the Cloud Monitoring Product.
Re: Luvit – Asynchronous I/O for Lua
#15Earlier quoted context omitted.
> Lua is a scripting language, perhaps a bit more structured than it's more popular counterparts (JavaScript and Python) I wouldn't say it has more structure than Python or JavaScript. Lua has only these types: number, string, boolean, table, function, nil, userdata and thread. Table acts as a hybrid between list and map, just like Array/Object in JavaScript. And users rarely are exposed directly to userdata/thread,…
I thought Lua used a register based VM.
Re: Luvit – Asynchronous I/O for Lua
#16Re: Luvit – Asynchronous I/O for Lua
#17Not sure exactly how duped this is for HN... For those that don't know.. Lua is a scripting language, perhaps a bit more structured than it's more popular counterparts (JavaScript and Python), having very good performance characteristics. It's very popular in terms of Game development. Luvit is essentially a lua interpreter with bindings to libuv (the same core IO library used in NodeJS). And could mainly be consider…
> Lua is a scripting language, perhaps a bit more structured than it's more popular counterparts (JavaScript and Python) I wouldn't say it has more structure than Python or JavaScript. Lua has only these types: number, string, boolean, table, function, nil, userdata and thread. Table acts as a hybrid between list and map, just like Array/Object in JavaScript. And users rarely are exposed directly to userdata/thread,…
Lua has true multiple return value support. The overall usefulness of tuples in light of this feature is not clear.
Lua has first class support for functions and actually supports functional programming unlike Python which cripples many techniques and where Javascript has broken lexical scoping. Lua uses metamethod programming to allow you to build functionality like classes; Javascript has prototype inheritance which is different than Python's classical inheritance. Each is just different; not necessarily more or less structured.
Also, never confuse simple for being primitive. Lua IS incredibly simple and elegant. But all the simple things in the language work together elegantly to allow for amazingly sophisticated things.
Re: Luvit – Asynchronous I/O for Lua
#18Earlier quoted context omitted.
I thought Lua used a register based VM.
No, it's a stack machine. See http://www.lua.org/manual/5.1/manual.html#3
Re: Luvit – Asynchronous I/O for Lua
#19For those interested, lthread now supports AIO. It's still in dev branch, but I'll be merging it soon: http://webmon.com/blog/2013/02/19/lthread-now-supports-userl... https://github.com/halayli/lthread/blob/dev/src/lthread_io.c
digressing from luvit... how does the stack copying technique (as used in lthread) compare to segmented stacks (as used in go)? The swap technique is very simple but I would assume that the stack copy shows up in profiles and is significantly slower than the segmented stack technique... Are there any benchmarks?
Lthread is in C, an environment where you control/manage your memory. Using slab allocators and high performance malloc like jemalloc, you can avoid allocating a lot of your variables on the stack and the stack copy will become minimal. In most of the production code I have running using lthread, stack copying is on the average of 300 bytes.