|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to improve performance of this loop? |
« View previous topic :: View next topic » |
Author |
Message
|
Bartez75 |
Posted: Wed Jun 10, 2009 7:16 am Post subject: How to improve performance of this loop? |
|
|
 Voyager
Joined: 26 Oct 2006 Posts: 80 Location: Poland, Wroclaw
|
Hi
This topic is connected to this one: http://www.mqseries.net/phpBB2/viewtopic.php?t=49439 but I think I have to create a new one.
Do you have any suggestion on improving performance of this loop below?
The input message is MRM/XML, output is MRM/TDS.
Code: |
DECLARE i INTEGER 1;
DECLARE refOrder REFERENCE TO InputRoot.MRM.ns:Data.ns:Order[1];
WHILE LASTMOVE(refOrder) DO
SET OutputRoot.MRM.Order[i].NMID=refOrder.id;
SET OutputRoot.MRM.Order[i].NUBSL=refOrder.ns:Row.slRow;
MOVE refOrder NEXTSIBLING NAMESPACE ns NAME 'Order';
SET i=i+1;
END WHILE;
|
In real loop there are many fields to map. I just put two to make it simple. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Thu Jun 11, 2009 12:36 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
Instead of using indices in the outputroot (OutputRoot.MRM.Order[]) use create lastchild and a reference variable to add the Order elements.
e.g something along the lines of (not tested but should give you something to try)....
Code: |
CREATE LASTCHILD of OutputRoot.MRM NAME 'Order' AS PTR
SET PTR = ROW('NMID' AS refOrder.id, 'NUBSL' AS refOrder.ns:Row.slRow)
|
|
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Jun 11, 2009 12:57 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Bartez75,
Use FOR loop and don't engage a counter, only references.
Regards. |
|
Back to top |
|
 |
Bartez75 |
Posted: Thu Jun 11, 2009 6:18 am Post subject: |
|
|
 Voyager
Joined: 26 Oct 2006 Posts: 80 Location: Poland, Wroclaw
|
Thanks for hints. I have modified this loop and it is really fast now.
My test case went 4 times faster.
It looks more less like that now:
Code: |
DECLARE NMCIL CHARACTER 'testValue1';
DECLARE NUBSL CHARACTER 'testValue2';
FOR refOrderIn AS InputRoot.MRM.ns:Data.ns:Order[] DO
CREATE LASTCHILD OF OutputRoot.MRM AS refOrderOut TYPE Name NAME 'Order';
SET refOrderOut = ROW(
refOrderIn.id AS NMCIL,
refOrderIn.ns:Row.slRow AS NUBSL
);
END FOR;
|
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|