Benchmark of String Comparison Methods

The fastest way of identifying (non)empty strings in Perl is the direct method ($foo eq ''), the slowest is the regular expression ($foo =~ /^$/):


My own results:
             Rate regexp direct length
regexp  4219409/s     --   -76%   -78%
direct 17543860/s   316%     --    -7%
length 18867925/s   347%     8%     --
             Rate regexp length direct
regexp  5128205/s     --   -73%   -74%
length 18867925/s   268%     --    -6%
direct 20000000/s   290%     6%     --