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 » The better Conditional Statement in ESQL

Post new topic  Reply to topic
 The better Conditional Statement in ESQL « View previous topic :: View next topic » 
Author Message
PP327475
PostPosted: Tue Mar 03, 2015 4:55 am    Post subject: The better Conditional Statement in ESQL Reply with quote

Newbie

Joined: 03 Mar 2015
Posts: 2

Hi,
I wanted to know with respect to efficiency which is better:
1.If Else ElseIF
2.CASE when

Which is faster when it comes to ESQL processing?
Back to top
View user's profile Send private message Send e-mail
adubya
PostPosted: Tue Mar 03, 2015 5:00 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

I would imagine the answer is "it depends..."

Run a user trace and look at the invocations involved / time taken for both of the approaches.


Last edited by adubya on Tue Mar 03, 2015 5:17 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Tue Mar 03, 2015 5:10 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

My preference is for then there are more that 3 items in the IF ... ELSE IF
then I use a CASE structure.

It is a lot more readable and maintainable IMHO.

And a lot more extensible as well.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 03, 2015 5:23 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

adubya wrote:
I would imagine the answer is "it depends..."




My personal view lines up with that of my worthy associate; anything more than a few items in an IF ELSE IF group is more readable and maintainable as a CASE structure.

I would also wonder if, assuming an IF ELSE IF turned out to be more efficient, the difference in execution time between that and a CASE statement would be worth the additional time taken in future development and problem resolution.

It's also not the first place I'd look to improve a poorly performing flow.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
PP327475
PostPosted: Tue Mar 03, 2015 5:37 am    Post subject: Reply with quote

Newbie

Joined: 03 Mar 2015
Posts: 2

Hey guys,
Thanks for the instant reply.
Well for my case theres like i guess 5 conditions and one default and each condtion perfomring additional 2 statements.
The look and readability is a second thing.
Priority goes to processing as this flow takes in a lot of data traffic.

Il try and see waht the user trace tells me.
Will let ul know
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Mar 03, 2015 6:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

PP327475 wrote:
Il try and see waht the user trace tells me.


Experimentation is the key.

One suggestion if you want to try this under load (where a user trace becomes unwieldy) would be to enable the monitoring and statistics for the flow, with specific reference to the node with this construct. You can then gather timings for the flow and the node (but not, I accept, that piece of ESQL) and see which version performs better on average over a large number of executions.

You clearly would also need something to process and interpret the stats; one cheap solution I've used is a simple flow to dump the event tags into a db and then import the data to Excel! Other and better solutions are undoubtably available, and all would be better than a user trace from a load test.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 03, 2015 6:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

PP327475 wrote:
Priority goes to processing as this flow takes in a lot of data traffic.


For the record, how much data traffic is "a lot", what's the SLA on the flow and how chunky is the server running broker?

You may find in load testing you don't have as much of a problem as you think.....
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » The better Conditional Statement in ESQL
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.