Multiple self::getgamestatevalue and performance

Game development with Board Game Arena Studio
Post Reply
User avatar
Badguizmo
Posts: 76
Joined: 11 October 2020, 14:27

Multiple self::getgamestatevalue and performance

Post 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 ;)
Official BGA developper newb :oops:
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Multiple self::getgamestatevalue and performance

Post by Victoria_La »

If you call it like 5 times it won't be noticeable
If 10000 maybe...
User avatar
Badguizmo
Posts: 76
Joined: 11 October 2020, 14:27

Re: Multiple self::getgamestatevalue and performance

Post by Badguizmo »

When I say "multiple", I mean around 40 times in the "game.php", in multiple functions ;)

But I get the idea :D
Official BGA developper newb :oops:
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Multiple self::getgamestatevalue and performance

Post 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 ?
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Multiple self::getgamestatevalue and performance

Post 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.
User avatar
Badguizmo
Posts: 76
Joined: 11 October 2020, 14:27

Re: Multiple self::getgamestatevalue and performance

Post by Badguizmo »

Thank you all.

I will check that and do some optimisation 8-)
Official BGA developper newb :oops:
Post Reply

Return to “Developers”