Topic:   Output array list or webMethods service append to document list which one is a better option
Sep 25, 2013 20:42 2 Replies 4032 Views Asadul
Prev Next
Topic Replies (2)
  1. 1
    idnkx user

    Asadul

    Hi,

    I have a requirement to loop and map over a document list and the document list is having other document lists as childs...

    Well we have different alternatives to map from one structure to other, i would like to know from below which one would be a better alternative:

    1) Output array list in a loop
    2) Using webMethods service append to document list
    3) Mapping using indexes or indicies

    1
    idnkx user

    Pradip

    Hello Asadul,

    It would be better if you avoid appendToDocumentList and try to implement your flow with other two alternatives, reasons below:

    There is a set of reaction which you get when one talks about the usage of appendToDocumentList e.g.

    Performance is badly hit with appendToDocumentList.

    Stay away from appendToDocumentList and use PSUtilities service addToList.


    The alternates of appendToDocList which one should consider before going for appendToDocList.

    [b]Explicit Loop:[/b] If the size of output document list to be created is same as input document list use output array option in loop.

    Sometime there are [b]conditional mappings[/b] and output document list can be different from the input one. In that case try and use PSUtilities.list:addToList. Create a copy of this service in your package and use it.

    [b]Implicit Loop: [/b]for simple lists of the same size, you may want to link them directly in a MAP step and let the IS handle the looping implicitly.

    [b]Java Loop:[/b] Write a java service for looping logic.

    [b]Reasons to avoid appendToDocList:[/b]

    For large lists, appendToDocumentList performs poorly because of the way it is implemented. Every time you call appendToDocumentList, it basically creates a brand new list with size equal to plus 1 (assuming you're appending one item). It then copies all the items from the original list to the new list and puts the appended item at the end of the new list. This frequent memory reallocation and copying of data is what gives you the performance hit.

    When you use an output array, output array is allocated once with the same size as the input array so you don't run into this problem.

    Test to compare different methods of mapping a source list to a target list involving large lists (up to 100,000 items), and at the time, they ranked as follows from fastest to slowest:

    1. [b]Java Loop:[/b] looping done through a Java service.

    2. [b]Implicit Loop:[/b] for simple lists of the same size, you may want to link them directly in a MAP step and let the IS handle looping implicitly. Works when the variable names inside a doc list are identical.

    3. [b]Explicit Loop:[/b] using a LOOP step and its Output Array.

    4. [b]Append to Array List:[/b] similar to append to document list except that an array list is used in the background so there's no reallocation and copying of data. It is important to set an appropriate initial size to maximize performance.

    5. [b]Append to Document List:[/b] using the WmPublic service.

    6. [b]Dynamic Index:[/b] using a LOOP step without specifying Output Array and mapping to a specific item in the output list using a variable index

    [b]Note:[/b] Time taken to copy the lists grew linearly as the size of the list grew for method 1 to 4 and grew exponentially for method 5,6.

    One new question arises after reading "appendToDocumentList performs poorly for larger lists" is what is a large list? It depends on the physical resources available to the IS and complexity of your mappings, etc.

    Hope now you got all the alternatives in place.

    Thanks,
    Pradip

Leave a Reply
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect