Created
September 11, 2012 03:14
-
-
Save sun/3695687 to your computer and use it in GitHub Desktop.
bench: Compare Boolean value to FALSE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> php bench.php | |
Peak memory before test: 422.43 KB | |
Iterations: 1,000,000 | |
nothing: 0.2577 seconds | |
function no_op(): 1.4858 seconds | |
!$value: 0.3877 seconds | |
$value === FALSE: 0.3837 seconds | |
FALSE === $value: 0.3868 seconds | |
$value == FALSE: 0.3889 seconds | |
FALSE == $value: 0.3873 seconds | |
Peak memory after test: 422.43 KB | |
Memory difference: 0.00 KB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source? Also, the difference is so small it very well can be a measuring error. Did you try running this a couple times? The difference between === and == must be valid because == is a much more complex operation.