Re: Which is faster?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jun 01, 2004
- 501 views
On Tue, 1 Jun 2004 11:30:19 -0400, Lucius Hilley <l3euphoria at bellsouth.net> wrote: >Which is faster? > >}}} <eucode> >if (line[1]='[' and line[length(line)] = ']') then >OR >if (equal("[]", line[1] & line[length(line)])) then ></eucode> {{{ > > unkmar The first, by a factor of about 5 when line[1] is not '[', and by a factor of about 3 when it is, the difference being whether the "and" part is short-circuited. The second is always much slower because it has to create and destroy a sequence of length 2. There is a builtin time() function which you can use to test this) Regards, Pete