On Sun, 25 Dec 2016 18:31:19 +0100 "Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net> wrote: > we've got *a lot* of objects holding a reference to Game objects > and lots of places retrieving it via getGame() calls, or getting > specification object Game::getSpecification(). > > Is there any usecase for having multiple Game objects within one > process ? Otherwise we could make it a singleton, for efficiency. > (we could even make its contents, eg specification singleton)
There is usually only zero, one, or two game objects (client + server). However there are some corner cases, and handling the places where the client and server threads transition from having no game to having a new game and communicating their state to the player threads, and then subsequently clearing back to no game... well it is better than it was a few weeks ago because I have been busy in that area but it is still non-trivial. Beware also that in the longer term we hope to change things so that the game currently shared by the server and the AI clients can be distinct. As usual I have to ask what problem you are trying to solve? It sounds like you are worried that the getGame calls are inefficient. Please do some profiling. You will see that stuff like this is down in the noise. Or indeed, imagine that you went ahead and turned all the game objects into suitable singletons and accessed them that way, *and* measured the difference --- let me speculate the gain would be *tiny* if anything as a lot of those calls will be getting auto-inlined anyway. I am sorry I keep arguing with you, I really appreciate that you want to improve the FreeCol codebase, but we need to put our effort into stuff that is *broken*. FreeCol is without a release for too long, there is a serious bug blocking release, I think it can be fixed by finishing a long planned but eternally postponed low-level c-s rewrite, which is mostly done, but some hard bits remain. Destabilizing the code with changes that do not actually fix bugs or improve performance is not a good idea right now, at least until we can get 0.11.7 released. Cheers, Mike Pope
pgpBL5saazVkb.pgp
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel
_______________________________________________ Freecol-developers mailing list Freecol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freecol-developers