reduce allocations at subscription.GetID() because why not.

This commit is contained in:
fiatjaf
2024-09-29 07:55:06 -03:00
parent 7e0f1bd43c
commit 24343dbbef
3 changed files with 32 additions and 17 deletions

View File

@@ -1,6 +1,8 @@
package nostr
import (
"strconv"
"strings"
"sync"
"unsafe"
@@ -92,3 +94,8 @@ func arePointerValuesEqual[V comparable](a *V, b *V) bool {
}
return false
}
func subIdToSerial(subId string) int64 {
serialId, _ := strconv.ParseInt(subId[0:strings.Index(subId, ":")], 10, 64)
return serialId
}