Page 1 of 1

Multiple self::getgamestatevalue and performance

Posted: 29 December 2020, 14:53
by Badguizmo
Hello.

In my code I have multiple calls to "self::getgamestatevalue(variable name)".

Does the number of calls impact the performances ?
Is it better to call it once and pass the values as parameters ?

Thank you ;)

Re: Multiple self::getgamestatevalue and performance

Posted: 29 December 2020, 18:06
by Victoria_La
If you call it like 5 times it won't be noticeable
If 10000 maybe...

Re: Multiple self::getgamestatevalue and performance

Posted: 29 December 2020, 21:46
by Badguizmo
When I say "multiple", I mean around 40 times in the "game.php", in multiple functions ;)

But I get the idea :D

Re: Multiple self::getgamestatevalue and performance

Posted: 29 December 2020, 22:53
by Tisaac
Badguizmo wrote: 29 December 2020, 21:46 When I say "multiple", I mean around 40 times in the "game.php", in multiple functions ;)

But I get the idea :D
But that's probably not going to be called during the same request since they correspond to différent states, right ?

Re: Multiple self::getgamestatevalue and performance

Posted: 30 December 2020, 01:56
by Victoria_La
40 times during same state still fine, you can check db log, there is tons on stuff called by framework besides it
but in general yes - if you can do it once and pass around it probably better anyways.

Re: Multiple self::getgamestatevalue and performance

Posted: 31 December 2020, 16:19
by Badguizmo
Thank you all.

I will check that and do some optimisation 8-)