On Fri, May 10, 2013 at 3:31 PM, David Korn <[email protected]> wrote:
> cc: [email protected]
> Subject: Re: Re: [ast-developers] bool type not documented
> --------
>
>> What's the preferred form to use a bool for a plain *if* construct?
>> bool conditional ... if $conditional ; then
>> bool conditional ... if [[ $conditional == "true" ]] ; then
>> bool conditional ... if ((conditional)) ; then
>>
>
> I would use if ((conditional)) since it is fastest.
>
> I ran a loop with 10,000 tests on each of the three.
>         if $conditional took 16 seconds
>         if [[ $conditional == "true" ]] took 10 seconds
>         if ((conditional)) took 6 seconds

Makes sense from the logical standpoint, too. After all it's Boolean
arithmetic :)

Irek
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to