On 14-07-12 04:28 AM, Michael T. Pope wrote: > That too is a surprise. There is a handy utility to make a stack > trace in freecol/common/debug/FreeColDebugger/stackTraceToString(), which > could tell you why getDefencePower is being called. I would expect it to > be quite common during AI turns, but not during a player turn.
It looks like the biggest culprit is the screen repaint process. That calls MapViewer.getUnitInFront() which uses Tile.getDefendingUnit() which then uses getDefencePower(). It looks like this is determining the strongest unit on the tile. This is probably not easily solvable without some sort of caching of the situation or maintaining a list of units that is sorted by strength at each tile. I'm not sure it's even a performance issue worth the effort to sort out at this stage in development since there are other bigger issues. After all, it should be relatively rare that a tile contains a mega stack of doom (REF usually). I would be wary of introducing yet another source of bugs. In other words, it looks like it is merely a slight inefficiency rather than a bug. It's probably best to leave well enough alone. ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Freecol-developers mailing list Freecol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freecol-developers