ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to improve performance of this loop?

Post new topic  Reply to topic
 How to improve performance of this loop? « View previous topic :: View next topic » 
Author Message
Bartez75
PostPosted: Wed Jun 10, 2009 7:16 am    Post subject: How to improve performance of this loop? Reply with quote

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
View user's profile Send private message
WMBDEV1
PostPosted: Thu Jun 11, 2009 12:36 am    Post subject: Reply with quote

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
View user's profile Send private message
elvis_gn
PostPosted: Thu Jun 11, 2009 12:57 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Bartez75
PostPosted: Thu Jun 11, 2009 6:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to improve performance of this loop?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.