lua-users home
lua-l archive

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

Stefan <> 于2020年4月9日周四 上午8:14写道:

> I've conducted an experiment to speed up Lua state creation with static
> hash tables generated by GNU gperf and got some interesting results.

I uses thousans of lua VMs in one process for years (my project ) .
So I have the same motivation to optimize the initialization of the VM
, such as loading the libraries.

My solution is patching the lua VM to support :

1.  Sharing the function protos.
2.  Removing short string interning.
3.  Adding a bit to the mark of GCObject to prevent modification of a table.

And then , we can create a constant lua (library) table out of VM ,
and use it directly in multiple lua VMs. The same technique can be
used for a large datasets. We can load a lua table with huge datasets
in a seperated thread/VM , and access it in other multiple lua VMs