commit a73271e3d4d34b8a853e335573fc165f171648a8
parent 624a7b4e88f9c4c1d3cce4b688943c9b018fb2cb
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  6 Aug 2023 09:07:09 -0700
debug: remove note size debug
ThreadSanitizer was complaining about a data race
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/nostrdb/NdbNote.swift b/nostrdb/NdbNote.swift
@@ -53,12 +53,14 @@ class NdbNote: Encodable, Equatable, Hashable {
         self.owned = owned_size != nil
         self.count = owned_size ?? 0
 
+        #if DEBUG_NOTE_SIZE
         if let owned_size {
             NdbNote.total_ndb_size += Int(owned_size)
             NdbNote.notes_created += 1
 
             print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
         }
+        #endif
 
     }
 
@@ -102,10 +104,12 @@ class NdbNote: Encodable, Equatable, Hashable {
 
     deinit {
         if self.owned {
+            #if DEBUG_NOTE_SIZE
             NdbNote.total_ndb_size -= Int(count)
             NdbNote.notes_created -= 1
 
             print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
+            #endif
             free(note)
         }
     }
@@ -135,8 +139,10 @@ class NdbNote: Encodable, Equatable, Hashable {
         try container.encode(tags, forKey: .tags)
     }
 
+    #if DEBUG_NOTE_SIZE
     static var total_ndb_size: Int = 0
     static var notes_created: Int = 0
+    #endif
 
     init?(content: String, keypair: Keypair, kind: UInt32 = 1, tags: [[String]] = [], createdAt: UInt32 = UInt32(Date().timeIntervalSince1970)) {