Global Lua optimization. Part 1#3773
Global Lua optimization. Part 1#3773KionX wants to merge 0 commit intoFAForever:deploy/fafdevelopfrom KionX:deploy/fafdevelop
Conversation
|
I think we should start simple: only rescope common table and math operations. This is considered a good improvement according to the Lua book in the chapter 'Basic facts'. It is also easy to review and it won't cause any hidden issues. I agree with your last statement in #3511 that doing this type of work on all the files just makes them a lot more difficult to read. Instead, I think our focus should be on better memory management and refactoring hot-code to improve efficiency. An example of the former is #3743 that has a 10% improvement in performance when you have 900 ASF because of recycling of tables. An example of the latter is #3702 or #3718. where we drastically reduce the amount of Lua byte code generated and prevent table operations as much as possible. |
|
At the moment, the total number of microoptimizations is 25699. I don't plan any further work on the existing FAF code and am considering whole remake FAF. |
|
Yes - I'd say we limit it to:
And leave other engine and lua functions out of it, as they make the code a lot less readable. |
|
And what does a remake of FAF entail? 😄 |
|
I suggest a couple more optimizations: The main idea of the FAF remake is that everything will be written in LuaJIT x64. |
|
I'd be fine with this list:
Anything else is not required for the average code and can lead to errors down the route. As an example, if you'd optimize the brain and use
|
|
Number of optimizations 4585(globals, math, table, string, exclude ui). |
|
This is looking good. Surprised to see that the number of optimizations is still so high. Good idea to include the string functions too. I'll look through it and experiment with it. Great work. |
|
Think about using this https://github.com/FAForever/FAFLuaJit for the lua test. |
|
What's with this PR? |
|
I've been testing it on the benchmark map and did not notice a significant change. I'm not sure if it is worth it. |
|
If it does not spoil the convenience, then it will not be worse. |
Continued #3511
A total of ~1000 files are expected.
Number of optimizations 4585(globals, math, table, string, exclude ui).