Use memchr for performance
```ruby s = "b" str = ("a" * 100 + s) t = Time.now str.index(s) puts Time.now - t ``` before => 0.000788 after => 0.000508 --- ```ruby s = "b" str = ("a" * 100 * 1024 * 1024 + s) t = Time.now str.index(s) puts Time.now - t ``` before => 0.225474 after => 0.008658
Showing
Please register or sign in to comment