fast-ruby
fast-ruby copied to clipboard
`String#match` vs `String#scan`
Hello.
These methods are pretty similar.
I've done some benchmarks and figured out that match is twice faster than scan.
I can try to make a PR, but not sure do we need for it here.
Friendly reminder: String#match outputs a MatchData while String#scan outputs an Array.
Friendly reminder:
String#matchoutputs aMatchDatawhileString#scanoutputs anArray.
Yes, but they're similar, but an outside code will be different for the same input data (String and Regexp). But the point of comparison of these approaches is they complete the similar goal.
@AlexWayfer If you're still interested in this, feel free to open a PR. All you need to do is follow the guidelines in the CONTRIBUTING.md.