will / crystal-pg

a postgres driver for crystal
BSD 3-Clause "New" or "Revised" License
462 stars 77 forks source link

Refactor `String#split` to `String#partition` #242

Closed straight-shoota closed 2 years ago

straight-shoota commented 2 years ago

This is a performance improvement. partition doesn't allocate an array.

As a side effect, this also gets rid of rescuing IndexError (cf https://github.com/crystal-lang/crystal/issues/11565#issuecomment-1003040007).

will commented 2 years ago

Nice