20 % faster lua with goto labels

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
User avatar
trad_emark
Inserter
Inserter
Posts: 23
Joined: Fri Sep 23, 2016 8:54 pm
Contact:

20 % faster lua with goto labels

Post by trad_emark »

According to this video recording of a talk from c++con, one can speed up LUA by small change in code - replacing large switch of functions with a table with goto label pointers, a generally unknown extension to c++.

https://youtu.be/IAdLwUXRUvg?t=1879 (do not let his hat distract you :D)

I do not know what LUA implementation is used in factorio and if rebuilding LUA from source is possible, but I thought it might be worth mentioning it here.

The factory must grow!

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 950
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: 20 % faster lua with goto labels

Post by ratchetfreak »

I would be surprised if the compiler didn't already do something like that. Large switch statements are a very attractive target for this kind of automatic optimization.

User avatar
leadraven
Filter Inserter
Filter Inserter
Posts: 354
Joined: Fri Jan 18, 2019 7:23 pm
Contact:

Re: 20 % faster lua with goto labels

Post by leadraven »

No optimization is worth such blasphemy.

Post Reply

Return to “Ideas and Suggestions”