use IndexByte instead of IndexRune everywhere because it's faster.

This commit is contained in:
fiatjaf
2025-05-05 23:37:43 -03:00
parent 3723924561
commit 0ae2316523
4 changed files with 9 additions and 9 deletions

View File

@@ -22,11 +22,11 @@ type MessageParser interface {
// Deprecated: use NewMessageParser instead
func ParseMessage(message string) Envelope {
firstQuote := strings.IndexRune(message, '"')
firstQuote := strings.IndexByte(message, '"')
if firstQuote == -1 {
return nil
}
secondQuote := strings.IndexRune(message[firstQuote+1:], '"')
secondQuote := strings.IndexByte(message[firstQuote+1:], '"')
if secondQuote == -1 {
return nil
}