method | nil | speed | str | speed |
---|---|---|---|---|
?split:[] |
9,761,148.9 i/s | 2,869,972.9 i/s | 3.40x | |
&.split||[] |
9,271,343.0 i/s | same | 2,879,248.1 i/s | 3.39x |
&&split||[] |
9,096,687.7 i/s | same | 2,941,303.8 i/s | 3.32x |
to_s.split |
4,288,858.0 i/s | 2.28x | 2,822,293.7 i/s | 3.46x |
ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]