Reputation: 1672
In some Redis loading tests, LuaJIT 2.0 (beta) is performing quite nicely, at about 60% of the runtime of a similar single threaded Python script.
When using Python's multiprocessing module to chunk large text files, results in a significant performance improvement splitting the works across cores.
I am assuming using the same approach in Lua would perform even better, but as a Lua beginner, I have not found the correct approach. Can anyone point me in the right direction?
Upvotes: 5
Views: 1509
Reputation: 26171
There is LuaThreads, however, as explained here by Mike Pall, it isn't really the best solution for multi-threading and interlinked task (as all threads will hammer the single lock on the lua state).
However LuaLanes may provide what you need, but, seeing as you are using/favorable to LuaJIT and not just plain Lua, you can probably leverage the FFI to spawn system threads straight from LuaJIT and pass them a Lua callback (I'm not sure on the safety of this however, thats something for the LuaJIT mailing list).
Upvotes: 3