[General Question] Code performance…
-
Ahoy,
i am currently running through the code and try to optimize it and make it more modular to have less redundant code. I am currently stumble about the following question….
Often in the code for the various features the players ship, base or system is retrieved by pub::Player::GetShip/GetBase/GetSystem function calls. But we also have these information in the Players structure. Do those variables still reflect to the same information?? And wouldnt it be better (for code performance) to take the information from the Player structure then to retrieve it by function call?
I know a single call might make no difference but often functions are not called only once a second or a minute
Ideas?
-
I’d say it depends on the context. Usually those utility functions are really lightweight, so its basically sth like this:
call get_ship_id mov var, eax
get_ship_id:
mov eax, [this_ptr + 0x12345] ret
So yeah, you might save some instructions but all in all this is sth I would consider as insignificant compared to some other stuff that is going on in FLHook.