-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid constructing a Regexp when splitting a String with negative limit
When splitting a string using a String pattern, we don't want to turn it into a Regexp unless we absolutely have to. Prior to this change, passing a negative limit into String#split would have forced this conversion and incurred a high performance cost as a result. Running the benchmark for this particular case shows a three-fold improvement.
- Loading branch information
1 parent
7978c7d
commit 04ca45e
Showing
1 changed file
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters