Re: time to create / memory footprint of VM

  • From: Tim Caswell <tim@xxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 15 Jul 2012 20:05:57 -0500

Mike, I didn't realize that coroutines were that cheap!  How to they
compare to just using callbacks for everything like we do in
nodejs/luvit?  I assume callbacks are cheaper, but I've been proved
wrong before.

On Sun, Jul 15, 2012 at 6:47 AM, Mike Pall <mike-1207@xxxxxxxxxx> wrote:
> Tobias Oberstein wrote:
>> Could someone give me a rough estimate on
>> - time it takes to instantiate a new VM
>  2 microseconds for lua_open()                    (no libraries)
> 30 microseconds for lua_open() + luaL_newstate()  (with all default libs)
> (On Linux/x64 at 3 GHz)
> You can cut down on the overhead if you don't need all libraries.
>> - the minimal memory footprint of a newly created VM instance
>  8 KB without any libraries
> 23 KB with all libraries
> That's the minimum footprint with a shared allocator across all
> instances (i.e. the system allocator, not the builtin one).
>> Say I have a process creating 10k VMs. How long will it take, how
>> much memory consume?
> That's not a useful scale for VM instances. Use one VM for each
> thread and divide them up with coroutines. Each coroutines needs
> only around 400 bytes, including a minimal stack.
> --Mike

Other related posts: