Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize
String#rchop?()
(crystal-lang#15175)
This is similar to crystal-lang#15153. * Uses `Char::Reader` to read backwards from the end of the string. This does not require decoding the whole string, unlike calculating `size - 1`. * If the current string does not end with an ASCII character and its size is unknown, `#single_byte_optimizable?` traverses the entire string. This is no longer unnecessary because the above handles everything already. * If the current string's size is known, the new string's size can be derived from it.
- Loading branch information