samedi 28 janvier 2017

singleton pattern performance drawbacks

I implemented the Singleton pattern in my game to access instance functions and variables like they were static. All well and good, I can use it conveniently. However, from my understanding, everything has a cost and this ease of use must have some kind of drawback. Question is, is it a lot of expense to frequently use GameManager.instance.someOtherClass.someVariable for example? In general, how performance friendly the Singleton is?

Aucun commentaire:

Enregistrer un commentaire