Scenario: In a large module (hundreds of areas, many thousands of objects), I want to run a pseudo heartbeat in several of the areas, when PCs are in them. That’s easy enough to set up. But, in each of those areas there are between 15 - 30 special waypoints with the same tag and I want to pick one of them randomly in the HB for some activity.
One option is to set things up so that all of those waypoints in the several areas have the same tag and then use GetNearestObjectByTag() along with some object in the area to make sure I am getting a WP in the current area.
Another option is to set up each area so that its waypoints have the same tag, but that tag is different for each area and then use GetObjectByTag(), which searches over the whole module.
Which is more efficient, in terms of CPU use (e.g. potential lag)? The lexicon page for GetObjectByTag() suggests that it is more efficient because the game maintains a hash of objects by tag and it can do a quick search of them. But, the first approach has the advantage of searching through the smaller number of objects that are in one area, rather than through all the tags in the module.