I just posted benchmarks for checking for an empty string that I ran when looking to improve the efficiency of an application. Another simple benchmark I ran was for ways to check if an array is empty.
Like strings, there are a ton of ways to check if am array is empty. These here are not exhaustive, but a few that I chose to test:
- $array == false
- count($array) == 0
- $array == array()
I run an application that requires a very high level of efficiency due to very high volume. I recently did an evaluation of efficiency for this application and performed a benchmark on a number of important aspects of the code. My findings were very interesting.
As you may know, there are a ton of ways to check if a string is empty. These here are not exhaustive, but a few that I chose to test:
- $string == false
- strlen($string) == 0
- $string == ” Continue reading