Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix performance regression in split by avoiding allocating substring …
…per char (#237) This PR fixes a performance regression from #227 / 4c85bde which I overlooked in review: When generalizing the optimized non-Pattern-based split code, that commit introduced a `.substring()` on each character, producing tons of garbage. Instead, I think we can do a `.startsWith(splitPattern, i)`: this should be much faster because it will avoid unnecessary garbage string creation (plus I'm pretty sure that `startsWith` is optimized in modern JDKs). I also removed the use of `breakable` and replaced it with an update to the `while` condition.
- Loading branch information