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:
@@ -24,13 +24,14 @@ class ContentParserTests: XCTestCase {
|
||||
let url = "https://media.tenor.com/5MibLt95scAAAAAC/%ED%98%BC%ED%8C%8C%EB%A7%9D-%ED%94%BC%EC%9E%90.gif"
|
||||
let content = "gm 🤙\(url)"
|
||||
|
||||
let blocks = parse_note_content(content: content, tags: []).blocks
|
||||
let blocks = parse_note_content(content: .content(content,nil)).blocks
|
||||
XCTAssertEqual(blocks.count, 2)
|
||||
XCTAssertEqual(blocks[0], .text("gm 🤙"))
|
||||
XCTAssertEqual(blocks[1], .url(URL(string: url)!))
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
func test_damus_parse_content_can_parse_mention_without_white_space_at_front() throws {
|
||||
var bs = note_blocks()
|
||||
bs.num_blocks = 0;
|
||||
@@ -38,7 +39,7 @@ class ContentParserTests: XCTestCase {
|
||||
blocks_init(&bs)
|
||||
|
||||
let content = "#[0], #[1],#[2],#[3]#[4],#[5],#[6],#[7], #[8], \n#[9], #[10], #[11], #[12]"
|
||||
|
||||
|
||||
let tagsString = "[[\"p\",\"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2\"],[\"p\",\"0339bb0d9d818ba126a39385a5edee5651993af7c21f18d4ceb0ba8c9de0d463\"],[\"p\",\"e7424ad457e512fdf4764a56bf6d428a06a13a1006af1fb8e0fe32f6d03265c7\"],[\"p\",\"520830c334a3f79f88cac934580d26f91a7832c6b21fb9625690ea2ed81b5626\"],[\"p\",\"971615b70ad9ec896f8d5ba0f2d01652f1dfe5f9ced81ac9469ca7facefad68b\"],[\"p\",\"2779f3d9f42c7dee17f0e6bcdcf89a8f9d592d19e3b1bbd27ef1cffd1a7f98d1\"],[\"p\",\"17538dc2a62769d09443f18c37cbe358fab5bbf981173542aa7c5ff171ed77c4\"],[\"p\",\"985a7c6b0e75508ad74c4110b2e52dfba6ce26063d80bca218564bd083a72b99\"],[\"p\",\"7fb2a29bd1a41d9a8ca43a19a7dcf3a8522f1bc09b4086253539190e9c29c51a\"],[\"p\",\"b88c7f007bbf3bc2fcaeff9e513f186bab33782c0baa6a6cc12add78b9110ba3\"],[\"p\",\"2f4fa408d85b962d1fe717daae148a4c98424ab2e10c7dd11927e101ed3257b2\"],[\"p\",\"bd1e19980e2c91e6dc657e92c25762ca882eb9272d2579e221f037f93788de91\"],[\"p\",\"32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245\"]]"
|
||||
|
||||
let tags = try decoder.decode([[String]].self, from: tagsString.data(using: .utf8)!)
|
||||
@@ -72,4 +73,5 @@ class ContentParserTests: XCTestCase {
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user