ridiculous performance string and serialization performance improvements.

This commit is contained in:
fiatjaf
2025-03-07 21:45:47 -03:00
parent 4431f58df2
commit 9e94310604
6 changed files with 18 additions and 13 deletions

View File

@@ -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])
}