CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

which is faster switch() or if() else; trees

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
neochrome32



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

which is faster switch() or if() else; trees
PostPosted: Mon Feb 24, 2014 8:32 pm     Reply with quote

CCS C 4.130
im not getting any meaning full info from my debugger so im calling on experiences Smile

i have a massive tree of register choices
currently i have

Code:

if(b==1)
do();
else if(b==2)
do();
else if(b==3){
some stuff here
}




i cant determine if above code would be faster/efficient

than

Code:

switch(b){
case 0:
break;
case 1:
..............
}


im trying to speed up my SID part of the speech chip,

currently im making choices on an tree off if else if's

thanks guys/gals Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 24, 2014 8:46 pm     Reply with quote

See these posts by Ttelmah:
http://www.ccsinfo.com/forum/viewtopic.php?t=47315
http://www.ccsinfo.com/forum/viewtopic.php?t=45415

This thread has links to even more:
http://www.ccsinfo.com/forum/viewtopic.php?t=42772
neochrome32



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

PostPosted: Mon Feb 24, 2014 9:20 pm     Reply with quote

thats weird, i did a search for this topic, i didn't find anything..........
thanks for pointing me at the right place Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 24, 2014 9:53 pm     Reply with quote

I had an advantage. I've been on the forum a long time and I knew
the posts were there. I just played around with search terms until
I found them.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group