Use template strings instead of join for speed

This commit is contained in:
Jon Staab
2025-01-02 10:41:26 -08:00
parent c1e9d99ad9
commit 462a2afe45
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ export class Address {
return new Address(event.kind, event.pubkey, identifier, relays)
}
toString = () => [this.kind, this.pubkey, this.identifier].join(":")
toString = () => `${this.kind}:${this.pubkey}:${this.identifier}`
toNaddr = () => naddrEncode(this)
}
+1 -1
View File
@@ -101,7 +101,7 @@ const _hasValidSignature = cached<string, boolean, [SignedEvent]>({
maxSize: 10000,
getKey: ([e]: [SignedEvent]) => {
try {
return [getEventHash(e), e.sig].join(":")
return `${getEventHash(e)}:${e.sig}`
} catch (err) {
return "invalid"
}
+1 -1
View File
@@ -71,7 +71,7 @@ export const getFilterId = (filter: Filter) => {
const v = filter[k as keyof Filter]
const s = Array.isArray(v) ? v.join(",") : v
parts.push([k, s].join(":"))
parts.push(`${k}:${s}`)
}
return hash(parts.join("|"))