Add Regexp#=== to match and =~ comparison by JuanitoFatas · Pull Request #62 · fastruby/fast-ruby
Same benchmark:
Calculating -------------------------------------
String#=~ 138.285k i/100ms
Regexp#=== 130.622k i/100ms
String#match 112.077k i/100ms
-------------------------------------------------
String#=~ 3.273M (± 2.6%) i/s - 16.456M
Regexp#=== 3.406M (± 4.3%) i/s - 16.981M
String#match 2.714M (± 2.8%) i/s - 13.561M
Comparison:
Regexp#===: 3406168.4 i/s
String#=~: 3273161.4 i/s - 1.04x slower
String#match: 2714176.6 i/s - 1.25x slower
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]
Mine has the lowest standard deviation @ ± 4.3%, also higher IPS
Essentially equal for me.
Edit: Ran it again, got similar to #59 (comment) but higher IPS:
Calculating -------------------------------------
String#=~ 143.101k i/100ms
Regexp#=== 138.872k i/100ms
String#match 118.070k i/100ms
-------------------------------------------------
String#=~ 3.332M (± 1.9%) i/s - 16.743M
Regexp#=== 3.482M (± 1.5%) i/s - 17.498M
String#match 2.746M (± 1.2%) i/s - 13.814M
Comparison:
Regexp#===: 3481922.4 i/s
String#=~: 3332209.4 i/s - 1.04x slower
String#match: 2745894.1 i/s - 1.27x slower