mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-19 10:36:42 +01:00
ridiculous performance string and serialization performance improvements.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
"github.com/colduction/nocopy"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"golang.org/x/exp/constraints"
|
||||
)
|
||||
@@ -134,7 +135,7 @@ func extractSubID(jsonStr []byte) string {
|
||||
end := bytes.Index(jsonStr[start:], []byte{'"'})
|
||||
|
||||
// get the contents
|
||||
return string(jsonStr[start : start+end])
|
||||
return nocopy.ByteSliceToString(jsonStr[start : start+end])
|
||||
}
|
||||
|
||||
func extractEventID(jsonStr []byte) string {
|
||||
@@ -149,5 +150,5 @@ func extractEventID(jsonStr []byte) string {
|
||||
start += 4 + offset + 1
|
||||
|
||||
// get 64 characters of the id
|
||||
return string(jsonStr[start : start+64])
|
||||
return nocopy.ByteSliceToString(jsonStr[start : start+64])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user