lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Apr 4, 2014 at 10:03 AM, Milind Gupta <milind.gupta@gmail.com> wrote:
> Thank you for your response, it is very helpful. Do you think that having
> many lua states has memory overhead that may be optimized in some way?


I haven't analyzed the relative overheads, but my gut feeling is that
if you have significant corpus of read-only shared state, it would be
better managed as external data.

the obvious example is a database, which can be shared not only
between threads but also processes, machines, or around the world.  Of
course, that's possible only because of the ACID guarantees.

but in a much less extreme case, an in-memory key/value database in C
could be perfect.  maybe just a wrapper on top of a C++ std:map.

a nice midpoint could be LMDB, a memory-mapped btree key/value
database with nice MVCC, ACID and very high performance. (there's a
simple Lua binding here: https://github.com/shmul/lightningdbm).

-- 
Javier