timing some variations on a theme

I thought I’d test the speed of some comparison variations in PHP. Here are the results:

testing (!(6|5)) 99999 times: 0.40472507476807
testing (!(6||5)) 99999 times: 0.36446118354797
testing (!6 && !5) 99999 times: 0.37069892883301
testing (6==0 && 5==0) 99999 times: 0.44164681434631
testing (6||5)!=0 99999 times: 0.39538788795471

Numbers were hard-coded. Language is PHP 4.3

Comments are closed.

%d bloggers like this: