[Chicago-talk] Which "if" structure is faster?

Jay Strauss me at heyjay.com
Sat Feb 21 17:55:12 CST 2004


I don't really have that option unfortunately

Jay
----- Original Message -----
From: "Steven Lembark" <lembark at wrkhors.com>
To: "Chicago.pm chatter" <chicago-talk at mail.pm.org>
Sent: Saturday, February 21, 2004 1:53 PM
Subject: Re: [Chicago-talk] Which "if" structure is faster?


>
>
> -- Jay Strauss <me at heyjay.com>
>
> > Hi,
> >
> > If I have some one time processing, then a endless loop (till the proc
is
> > killed).  Which is faster or are they the same:
> >
> > if ($firstTime) {
> >     ...stuff...
> >     $firstTime = 0;
> > }
> > else {
> >     ...stuff...
> > }
> >
> >
> > or
> >
> >
> > if (! $firstTime) {
> >     ...stuff...
> > }
> > else {
> >     ...stuff...
> >     $firstTime = 0;
> > }
>
> Probably simpler to deal with it via two calls.
>
> sub do_something
> {
> ...
> }
>
> do_something @first_time_args; # the first time
>
> for(;;)
> {
> do_something @other_time_args;
> }
>
> --
> Steven Lembark                               2930 W. Palmer
> Workhorse Computing                       Chicago, IL 60647
>                                             +1 888 359 3508
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
>




More information about the Chicago-talk mailing list