Avoid traversing the elements in sequence, starting from 1, until n is reached for every iteration of the loop. Instead, use a reference variable and the MOVE NEXTSIBLING syntax.
For a loop of 100 elements, index access notation results in 5000 (50 x 100) element traversals instead of 100 with the MOVE statement (50 times more). For a larger list of 1000 elements, it is worse; 500000 (500 x 1000) traversals instead of 1000 (500 times more).
Example of using reference variables
DECLARE empRef REFERENCE TO OutputRoot.JSON.Data.Employee.Item[1];
WHILE LASTMOVE(empRef) DO
empRef.Name = 'John Smith';
MOVE empRef NEXTSIBLING;
END WHILE;
Cardinality Function
The following guidelines apply to using this function:
- Don't use it to set an iterative limit on a loop that then uses array index notation.
- Don't use it to count the number of elements in a large, unparsed file since this will likely cause an abend.
- Don't use it to test for the existence of an element
Tree Access Order and Path References
Message trees are a complex data structure that behave much like a doubly linked list.
Ways to optimize performance include:
- locating often referenced items near the top of a child list
- defining reference variables for complex element paths in order to avoid repeated evaluations
- avoid generic recursive tree walks.
Use XMLNSC for XML Processing
XMLNSC is the most efficient XML parser in IBM® Integration Bus. Use it in preference to MRM and other XML parsers
Try to avoid chains of compute nodes in a simple msgflow that could be easily combined into one node.
Source: IBM © Integration Bus Information Centre
No comments:
Post a Comment