Skip to main content

Tips & Tricks: The Repeat Loop as Performance Killer

The repeat loop is principally a quick function which only becomes noticeably slower after a few thousand processes. The current arcplan realization at allocation (as mandatory with the numerator [OBJx] := [OBJx] +1), however, results in the increase of the running time upon allocation of values  in relation to the aggregate amount of the objects of the opened documents. (This is a problem of the fundamental programming of arcplan Enterprise when identifying the object in the object stack which contains all objects of all open documents). In case of complex applications, the running time of the repeat loop is therefore much higher so that it may be running for seconds, rather than milliseconds, even in case of only few entries. Therefore, if possible, all functionalities should be implemented without repeat loop in order to ensure a good performance.

Subsequently, we provide an example which is frequently realized with the repeat loop even though there is an implementation option with other formulas.

V-Lookup

V-Lookup is familiar because of the handling of Excel: if values from a basic table are supposed to be generated into dependent values, e.g. in order to read individual controlling parameters, V-Lookup is used in Excel. Individual keys are stated for which the dependent values are supposed to be generated.

In arcplan, this is also possible with a function, but this is not immediately obvious. Therefore, a combination of the functions REPEAT and FILTER is often used.

The arcplan function INTERSECTION as a solution

A more elegant solution is the function INTERSECTION which is able to reproduce 100% the V-Lookup familiar from Excel.

beispiel-funktion-schnittmenge

In the example, OBJ 5 contains the key and OBJ3 the pertinent parameter. In OBJ2 are the keys for which the values are required. OBJ4 contains the actual V-Lookup which identifies the values from OBJ3 which pertain to the keys stated in OBJ2. This function can be used for many thousands of entries regardless of the complexity of the application and offers a very high performance even in case of very large content.