Sign in to follow this  
Followers 0
HighGuy

Question concerning "case"

3 posts in this topic

Hi,

I'm using a "select..case..endselect" with a lot of case-expressions. I have the feeling, that if I add more and more "cases" the slower my app gets even if the matching case is at the beginning. The help file tells me that only the first matching case will be executed. Does this behavior include that all the other cases won't be "processed" afterwards? At the moment I suppose they will which is unnecessary in my opinion. Is this true?

Share this post


Link to post
Share on other sites



Hi,

I'm using a "select..case..endselect" with a lot of case-expressions. I have the feeling, that if I add more and more "cases" the slower my app gets even if the matching case is at the beginning. The help file tells me that only the first matching case will be executed. Does this behavior include that all the other cases won't be "processed" afterwards? At the moment I suppose they will which is unnecessary in my opinion. Is this true?

I'm pretty sure that oncethe matching case has been matched it jumps directly to the endselect statement so no penalty there. However it does test each case up to the matching case - so the further down the list the matching case is the slower it is.

Share this post


Link to post
Share on other sites

I'm pretty sure that oncethe matching case has been matched it jumps directly to the endselect statement so no penalty there. However it does test each case up to the matching case - so the further down the list the matching case is the slower it is.

As often, you're right Jon. I did some more testing and changed order of my case-expressions. Of course it took some time longer if I put them down the list. But I had one entry at the top that took quite a long time to "react" and that was the exit-function of my GUI. In that function I use GUIDelete() to clean it up and as I have a really big GUI with lots of controls that took a very long time. If I only use "exit" it terminates immediately. What stays is that the CPU is using a lot of "time" while doing nothing and I do not know where this load is coming from. GuiGetMsg()?

Thank you for your help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0