Subj : Translating CASE from BAS To : Mark Lewis From : Mike Luther Date : Sat Feb 10 2001 04:32 am Yur are precisely correct Mark ml> one of the things i was thinking about while writting the above was ml> 'program efficiency'... in some situations this can be ml> important... ml> if switch case is faster then if/then/else, then ml> 'converting' to single value for that purpose once is ml> a necessary evil until such time as one gets the ml> chance to rework that section... ml> thinking about situations where the switch case stuff ml> may possibly be executed hundreds of times a second vs ml> if/then/else trees running hundreds of times a ml> second... ml> == example == ml> red == 1; ml> blue == 2; ml> yellow == 3; ml> procedure routine1; ml> { ml> input "what's your color?",color$; ml> if color$ = "red" then color == red ml> else if ml> color$ = "blue" then color == blue ml> else if ml> color$ = "yellow" then color == yellow; ml> } ml> procedure routine2; ml> { ml> case color of ml> red : do_red_routine; ml> blue : do_blue_routine; ml> yellow : do_yellow_routine; ml> } ml> procedure routine3; ml> { ml> case color of ml> red : do_red_routine2; ml> blue : do_blue_routine2; ml> yellow : do_yellow_routine2; ml> } ml> { ml> routine1; ml> while 1==1 do ml> { ml> routine2; ml> routine3; ml> } ml> } ml> == end of example == Plus the worst of the Weevil's is that INSTR routines in BASIC, as most recently written are terribly fast from the way the assembler is coded that the modern compilers use! As well, if, as in my case, go-no/go decisions are expected in real-time to literally half-second do-it or don't-do-it decisions, you are comparing COMM port I/O in real time against networked stored data from the hard disk,record lock withstanding, in the middle of it all! What really makes it so intriquing to work with this stuff in OS/2, even in DOS-VDM's, is that the absolutely superb disk caching and HPFS file system begins to make what you are illustrating absolutely crucial in determining a fair shot at system-wide response time optimization! There is this superb joke about the two boll weevils! The 40# boll weevil eats twice as much cotton as the 20# boll weevil! Therefore, when you kill each with a double barrel 12 gauge, you fall on your knees and say, "Thank you Lord, for teaching me the lesser of two weevils! I've got seed left!" Not with OS/2. There is this voice from above that booms, "Sorry, your cotton was already gone by the time you got that Ithica! Next time get down your Browning! Make love, not war!" Chuckle. Mike @ 117/3001 --- Maximus/2 3.01 * Origin: Ziplog Public Port (1:117/3001) .