I'm curious to know which setup would be faster (in theory that is - I could just time it myself, I know):
1. Use CyTeam.isAtWar(CyGlobalContext.getPlayer().getTeam()) each time a unit moves onUnitMove to check whether or not the unit's owner is at war with a specific player/team.
2. Keep track of which teams are at war with the specific player/team by keeping a Python data structure around and updating a team index with True/False values with the onChangeWar call-up from the SDK. Then index the data structure with only the player ID onUnitMove to make the check.
Which would be faster? Maintaining and indexing a data structure or making three separate method invocations? And would a dictionary or a list/tuple be faster for indexing by a integer value?
1. Use CyTeam.isAtWar(CyGlobalContext.getPlayer().getTeam()) each time a unit moves onUnitMove to check whether or not the unit's owner is at war with a specific player/team.
2. Keep track of which teams are at war with the specific player/team by keeping a Python data structure around and updating a team index with True/False values with the onChangeWar call-up from the SDK. Then index the data structure with only the player ID onUnitMove to make the check.
Which would be faster? Maintaining and indexing a data structure or making three separate method invocations? And would a dictionary or a list/tuple be faster for indexing by a integer value?