Further performance improvements by removing unnecessary copies

This commit is contained in:
Junegunn Choi
2024-04-02 08:43:08 +09:00
parent a575c0c54b
commit c30e486b64
5 changed files with 15 additions and 8 deletions

View File

@@ -312,7 +312,7 @@ func parseAnsiCode(s string, delimiter byte) (int, byte, string) {
// Inlined version of strconv.Atoi() that only handles positive
// integers and does not allocate on error.
code := 0
for _, ch := range []byte(s) {
for _, ch := range sbytes(s) {
ch -= '0'
if ch > 9 {
return -1, delimiter, remaining