1. Which is faster?

Which is faster?

if (line[1]='[' and line[length(line)] = ']') then
OR
if (equal("[]", line[1] & line[length(line)])) then


    unkmar

new topic     » topic index » view message » categorize

2. Re: Which is faster?

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 blink)

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu