From: Sergey Matveev Date: Mon, 19 Jul 2021 11:17:36 +0000 (+0300) Subject: Optimize indexing X-Git-Tag: v2.2.0 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=00037b203eed13d9a1155b59a5169af9abc8745b;p=netstring.git Optimize indexing --- diff --git a/r.go b/r.go index ca19259..0637ec6 100644 --- 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") }