Oddbean new post about | logout
 Yeah - I get it and makes total sense.

DId you ever measure the difference between coredata vs. nostrdb when considering to build it? 
 Yes damus use to use coredata for our profile database. It was extremely slow and had many race conditions and contention issues. Switching to nostrdb made profile search so much more stable and faster. It’s actually live on the appstore version. The remaining work is replacing in-memory and from-network notes with nostrdb. There is a lot of duplicate work that is happening atm because notes are processed twice. So the perf boost should be substantial. I am also going to rework timeline ui rendering so that it’s not as slow, as that is the slowest part of damus atm. 
 Cool thing about nostrdb is that it is safe to  query it concurrently across threads. reads don’t require locks because of lmdb’s mmap + copy on write mechanism.

Most queries are fast enough to run on the main thread (0.01ms for pulling 10 notes), but it’s nice that you can safely offload queries to threads if you need to. Fulltext queries can sometimes take 70ms because of the compressed key index I’m using, so I leverage threads for those situations. 
 Nice 💪