]> Cypherpunks.ru repositories - netstring.git/commitdiff
Optimize indexing v2.2.0
authorSergey Matveev <stargrave@stargrave.org>
Mon, 19 Jul 2021 11:17:36 +0000 (14:17 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 19 Jul 2021 11:17:36 +0000 (14:17 +0300)
r.go

diff --git a/r.go b/r.go
index ca1925908d09e22a1c6b33fe487da9880c06216b..0637ec692af823aeaba9abf7ffe462a041b00677 100644 (file)
--- a/r.go
+++ b/r.go
@@ -48,7 +48,7 @@ func (r *Reader) Next() (uint64, error) {
        if len(p) == 0 {
                return 0, io.EOF
        }
-       idx := bytes.Index(p, []byte{':'})
+       idx := bytes.IndexByte(p, ':')
        if idx == -1 {
                return 0, errors.New("no length separator found")
        }