Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!elbereth.rutgers.edu!hardees.rutgers.edu!patterso From: patterso@hardees.rutgers.edu (Ross Patterson) Newsgroups: comp.lang.rexx Subject: Re: MVS REXX, Rexx in general - efficiency questions Message-ID: Date: 21 Jun 89 02:49:25 GMT References: <5805@hubcap.clemson.edu> Organization: Rutgers Univ., CCIS Lines: 31 Ncommand: followup To: grimlok@hubcap.clemson.edu > 1) Is copies(" ",80) any worse or better than copies(" ",40) or for > that matter copies(" ",20)? The first is obvious that I want an > 80 character string consising of blanks, it gets less obvious as we > go down. Probably the best thing is to set a variable to a constant > like spaces = " ...80 spaces..." but you have to split it up and > it becomes unreadable and the chances of mis-counting are great. > In short, how does copies() really work? In my experience with CMS REXX, there is no significant difference between the three examples you give. In any case, these things are typically only executed once, whenn initializing a constant ("Bar = Copies('=',72))". Using Copies is definitely better than hand typing a long, repetative constant, if only for readability. > 3) Are logical operators short circuiting? That is, if I say: > if x | y | z then ... and x is true, are y and z evaluated and or'd? > If z is true 90% of the time and x and y only 20%, should I put > if z | x | y then ... to save time, even though it is slightly less > intuitive? I know from seeing select traced that when a when > expression is true the other cases are bypassed. I believe your real questionnn is whether REXX fully evaulates conditional expressions, and the answer is yes. The entire IF, WHEN, DO UNTIL, or DO WHILE condition is evaluated each time, regardless of predictability. This is neither right nor wrong, it simply is. Each language designer makes a decision as to what the sequence of evaluation will be, and whether the compiler (or interpreter) guarantees that sequence. You won't see any performance improvement by ordering your "if x | y | z" as "if z | x | y". Ross Patterson Rutgers University