Oddbean new post about | logout
 Yes nostur has a coredata database. I found it too slow which is why i wrote nostrdb 
 I also wanted a database I could use in damus android+notedeck, if I built on coredata it would be a bunch of duplicated and wasted time. It’s nice I can use this in my multi-platform client as well. I want to use this as a way to quickly build new native nostr clients without having to do all the hard stuff each time. 
 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 💪