I have a list of elements that I have retrieved from PIAF. This list requires that all of its attributes be loaded. The handy "LoadElements" method was used and the performance of retrieving the elements and their attributes is sufficient for my needs.
Enter PI tags.
In my application, I require additional information about the PI tags that have been associated to my elements. Namely, the path, description, and engineering units. To achieve this, I iterate over each element in my list and run this code (or close enough as makes no difference):
PIPoint pipoint = myAttribute.PIPoint; string tagName = pipoint.GetPath(); pipoint.LoadAttributes("descriptor", "engunits");
This code seems pretty quick. Run it on its own and the results come back sub-second. However, in a case where I have 5,000 elements with up to 7 tag attributes each (so 35,000 tags), the performance drains. Even with Parellel loops, I can only seem to bring the performance down to ~30s. Keep in mind (if you try to run this) that I do have other properties of the tag that I retrieve (e.g. stateset), so it is not the only contributor to the 30s. However, it is this segment of code is the slowest (likely because of the lookup), so this is where I would like to start.