azerothcore / mod-eluna-lua-engine

DEPRECATED
https://www.azerothcore.org
34 stars 42 forks source link

Lua JIT support? #22

Closed FiftyTifty closed 4 months ago

FiftyTifty commented 4 years ago

A huge problem with Lua, is that it's performance is very slow. However, the JIT implementation is just a touch slower than C, according to: https://github.com/r-lyeh-archived/scriptorium

IIRC, Eluna processes all scripts in a single thread, which means that strong performance is paramount. Any chance of that being supported?

Viste commented 4 years ago

you already ask this on main LuaEngine repo https://github.com/ElunaLuaEngine/Eluna/issues/296 what for you duplicate its here? i think if you really need Lua JIT instead Lua Lib you'd have done it or pay someone for it, considering the first time you were interested in it was in August. Asking, waiting and hoping is a bad strategy

Viste commented 4 years ago

Okay, to be clear i can do it for $500.

FiftyTifty commented 4 years ago

Ah, I forgot I asked that question. Didn't see it listed in issues. It's not that I was waiting, it's that I got burnt out on dealing with Ubuntu always throwing bizarre errors when trying to get TrinityCore, and then AzerothCore, working. Back at it the now.

I'm not a C++ coder, as the language is just awful, at least compared to Delphi, which is the language I use. Just as fast as C++, while being so much better to read and type out. I'll see what I can do to rejigger it to use LuaJIT.

If that fails catastrophically, with no clear way of learning how to do it, I'd be up for paying for the change, especially if it's merged with the main branch of Eluna so everyone has access to it. $500 Though is a bit steep, unless it's a fairly involved ordeal.

Viste commented 4 years ago

It's a difficult task for one person. If we are talking about normal use of Lua JIT and multithreading. That is why the price is so high. also you can open repo with your work and ask some of AC or TC or Mangos coders help you In short, gather everyone, or only those who are interested, in one place, to work on one task

FiftyTifty commented 4 years ago

Ah right, if it includes multithreading functionality as well, then it seems not too harsh. It's an awful big task when I can barely rejigger existing C++, let alone reimplement a scripting language engine. I'm currently moving place, so money's a wee bit tight.

Once I've moved tho', which might be as late as January, I'll be more than willing to pay the $500, as long as you're okay with it being made available for everyone else to use as well. Gotta share this stuff for the good of the community.

ghost commented 4 years ago

UP the subject a little to see if there's any news on the progress of this one ?

FiftyTifty commented 4 years ago

I'm still willing to pay for this to happen, it's just that moving out took a couple grand out of my bank account, so I need to save up for the next couple months.

FrancescoBorzi commented 4 years ago

@FiftyTifty you can use bountysource and place a bounty on the issue

Rochet2 commented 4 years ago

For ppl interested, there is a somewhat working version at https://github.com/ElunaLuaEngine/Eluna/tree/luajit (eluna) https://github.com/ElunaLuaEngine/ElunaTrinityWotlk/tree/luajit (TC) luajit branch which you can see the changes of. Basically there are some minor changes in eluna and core and complete replacement of deps/lualib.

The branch implements the possibility of choosing your lua version (5.2, 5.1, luajit). The jit build probably does not work on mac. Note that the language itself has changes in jit vs 5.2, so some scripts may not work without changes.

This however does not mean that I am going to work on getting jit supported any time soon. Any help is appreciated. I decided to make this as a starting point for future work as I had most of the things already done for another project.

PS. after building the core you have to right click INSTALL in VS and click build to install all things to the path configured in cmake as cmake install directory.

Viste commented 4 years ago

@Rochet2 i help you when i finish some stuff i start rewrite in AC

Rochet2 commented 4 years ago

@Viste send a message if you need anything.

FiftyTifty commented 4 years ago

@Viste Sorry about this huge wait, a bunch of stuff happened so I was down on funds. But finally in the clear, so I can fund this development. How should we approach this? BountySource as @FrancescoBorzi suggested?

ghost commented 4 years ago

Up the subject !

Yehonal commented 3 years ago

I'm interested in this as well :) with the working progress project Eluna-TS I'm trying to bring the Eluna to the next level by having type-hinting features, unit tests with proper coverage and all the amazing tools of the typescript ecosystem. If it can be backed by the Lua JIT that would be great!

Who is working on it at the moment? are there any updates?

@FiftyTifty @Viste @Rochet2 we can participate in the fundraising as well. Let us know which are the progress

Rochet2 commented 3 years ago

Who is working on it at the moment? are there any updates?

As far as I know, the only work done so far is whatever is in the branches here: https://github.com/azerothcore/mod-eluna-lua-engine/issues/22#issuecomment-583090473 and Foereaper may have some related work of his own. Otherwise, I have not had any contact about this and have not worked on it.

FiftyTifty commented 3 years ago

I didn't hear back from Viste, unfortunately. So there's no progress outside of what Rochet2 mentioned.

Rochet2 commented 1 year ago

An update on this. Luajit support was added to Eluna (but not yet to azerothcore) in the following commits. The code allows selecting any lua version or luajit. https://github.com/ElunaLuaEngine/Eluna/commit/33d8e3793f615fed3928db09bccdb394289014ec https://github.com/ElunaLuaEngine/ElunaTrinityWotlk/commit/ac6dcd0fd633fc5bbc9073c65736467f527ae4b8 https://github.com/ElunaLuaEngine/ElunaTrinityWotlk/commit/4f19fe39364a9f07ec7183824551437e720166ac Luajit requires setting CMAKE_INSTALL_PREFIX and building INSTALL target in VS on windows to function properly.