ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
nil | slower | empty | slower | full | slower | |
---|---|---|---|---|---|---|
x&.empty? |
11985357.7 i/s | same | 11617138.6 i/s | same | 11247144.5 i/s | same |
x.blank? |
9909235.8 i/s | 1.21x | 10488507.9 i/s | 1.14x | 10418916.8 i/s | 1.15x |
x.nil? || x.empty? |
10194622.1 i/s | 1.18x | 9584369.0 i/s | 1.25x | 9667811.7 i/s | 1.24x |
x.try!(:empty?) |
5437472.5 i/s | 2.20x | 3493090.9 i/s | 3.43x | 3523153.2 i/s | 3.40x |
x.try(:empty?) |
5448509.8 i/s | 2.20x | 2109368.9 i/s | 5.68x | 2168337.2 i/s | 5.53x |