Perl && vs. and – || vs. or Benchmark

I want to compare the && vs. the and operator, and the || vs. or operator in Perl:

 

First result (1 && 0) vs. (1 and 0):

Second result (1 or 0) vs. (1 || 0):

Third result (1 && 1) vs. (1 and 1):

Fourth result (1 or 1) vs. (1 || 1):

It seems the “and” and “&&” don’t make really different, but the “or” and “||” operator seems different.I don’t know why the “||” are 18-48% faster than the “or” …. and the “and” is only about 1-3% faster.

 

Now we check if they work as they should:

result looks good they abort if a true is impossible:

That is more a check up and not really a Benchmark.

5 thoughts on “Perl && vs. and – || vs. or Benchmark”

  1. What’s up to all, how is all, I think every one is getting more from this web site, and yourr views are pleasant designed for new visitors.

  2. Pretty! This has been an extremely wonderful article.

    Thank you for supplying these details.

Leave a Reply

Your email address will not be published.

two × 3 =