Replies: 19 comments 9 replies
-
Here is an example of where I would benefit from LuaJIT: Sphene (a SCM virtual machine in MTA with the purpose of building a Co-Op experience on top of the singleplayer missions) only really uses MTA functions to read the files and for the implementation of the actual game logic. All the other logic (which is a lot of code, easily ran over hundreds of time per second) is just regular Lua that actually would see a nice performance boost if LuaJIT is available, this includes the logic that properly parses the parameters, handles if-statements, etc. This can finally help us get closer to getting Sphene to maintain a stable framerate which it currently is still struggling with. |
Beta Was this translation helpful? Give feedback.
-
Here is our original LuaJIT branch as reference: https://github.com/multitheftauto/mtasa-blue/commits/LuaJIT |
Beta Was this translation helpful? Give feedback.
-
Simulations on cars
In general any kind of simulation would profit from LuaJIT. Another point would be all kinds of processing strings in pure Lua. Note: I will edit my message when i find more (*1) requires fix of setAnalogControlState: #567 |
Beta Was this translation helpful? Give feedback.
-
In the meantime, on the server side, it's possible to use modules to interface Lua code with native C/C++ code, which can result in a nice performance boost, and the ability to communicate more easily with other languages and/or the underlying operating system. For a project like that, I guess you run most player-independent or synchronization logic in the server, so it could benefit from it. But nobody uses modules :( Back on topic, I think LuaJIT is a good choice, but I'm concerned that it may generate some inconvenience for server owners that use compiled scripts, because the bytecode generated with the standard Lua interpreter isn't compatible with LuaJIT's. I think that any change in the Lua VM which affects bytecode should be carefully done, with these pros and cons in mind. |
Beta Was this translation helpful? Give feedback.
-
Most of Sphene actually runs on the client (especially SCM interpretation) and even synchronization will mostly not be done on the server as it adds a lot of unnecessary overhead (including the fact that the server has no knowledge about the map). Naturally sending the information between the clients still would go through the server and could be moved into a module if we'd add extra checks to validate this data. |
Beta Was this translation helpful? Give feedback.
-
LuaJIT has a huge overhead when switches context (call Lua code from C-side), AFAIK. |
Beta Was this translation helpful? Give feedback.
-
cling based C++ as scripting language / hot code reload
|
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
I have no idea. @Cazomino05 worked on LuaJIT, perhaps he might remember what the status was at the time on the attempt. |
Beta Was this translation helpful? Give feedback.
-
Theres a waay bigger context switch penalty with JIT than with regular Lua, thus having LuaJIT would only benefit if you dont use MTA functions a lot, which isnt feasible that much(bc of dx rendering). Edit(2020.12.28): This comment is based on some random guy's comment over at discord, we really should do some tests, with actual gamemodes. IIRC theres a working LuaJIT MTA implementation already, made by a Hungarian guy. |
Beta Was this translation helpful? Give feedback.
-
Please checkout this Implementation of Lua 5.1, originally a fork of LuaJIT 2.0 |
Beta Was this translation helpful? Give feedback.
-
A discussion I had with sbx over at discord. Tldr: Sbx suggested we create a transpiler which would transpile Lua 5.1 native bytecode to LuaJIT 5.1. This should be implemented on MTA server, as all and every bytecode needs to be signed before its ran. |
Beta Was this translation helpful? Give feedback.
-
Made some research about the Memory limit in LuaJIT LuaJIT 2.1 is still in beta, but is still actively developed: |
Beta Was this translation helpful? Give feedback.
-
Okay, so I was thinking about this. |
Beta Was this translation helpful? Give feedback.
-
Some DC discussion we had: |
Beta Was this translation helpful? Give feedback.
-
With JIT (experimental build by @Pirulax without Lua BitOps) With JIT (experimental build by @Pirulax with Lua BitOps)
|
Beta Was this translation helpful? Give feedback.
-
Answering Einheit101:
Distadvantages:
|
Beta Was this translation helpful? Give feedback.
-
I use a lot of mta functions, so it probably wont do anything at all to server performance. Tests will reveal the truth |
Beta Was this translation helpful? Give feedback.
-
Are any servers actually struggling CPU wise? |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
There are many things that are not possible todo or cause performance problems because standart Lua is too slow.
Describe the solution you'd like
Yes, you can try to optimice things as much as you can, but everything has it's limits.
I would say we first try to gather examples were LuaJIT, would bring us better performance.
Here are also a few examples were LuaJIT profits over standart Lua: http://luajit.org/performance_x86.html
Beta Was this translation helpful? Give feedback.
All reactions