ndb: switch to nostrdb notes
This is a refactor of the codebase to use a more memory-efficient representation of notes. It should also be much faster at decoding since we're using a custom C json parser now. Changelog-Changed: Improved memory usage and performance when processing events
This commit is contained in:
@@ -12,21 +12,20 @@ struct ReplyDesc {
|
||||
let others: Int
|
||||
}
|
||||
|
||||
func make_reply_description(_ tags: [[String]]) -> ReplyDesc {
|
||||
func make_reply_description(_ tags: Tags) -> ReplyDesc {
|
||||
var c = 0
|
||||
var ns: [Pubkey] = []
|
||||
var i = tags.count - 1
|
||||
|
||||
while i >= 0 {
|
||||
let tag = tags[i]
|
||||
if tag.count >= 2 && tag[0] == "p" {
|
||||
var i = tags.count
|
||||
|
||||
for tag in tags {
|
||||
if let pk = Pubkey.from_tag(tag: tag) {
|
||||
c += 1
|
||||
if ns.count < 2 {
|
||||
ns.append(tag[1])
|
||||
ns.append(pk)
|
||||
}
|
||||
}
|
||||
i -= 1
|
||||
}
|
||||
|
||||
|
||||
return ReplyDesc(pubkeys: ns, others: c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user