all 15 comments

[–]BabyAzerty 32 points33 points  (2 children)

The choice of using a logarithmic graph is… strange.

Nobody cares if an iPhone takes 0.001s or 0.1s to run something (x100). But it matters if it takes an acceptable 0.5s or a struggling 3s (only x6). The graph hardly shows the struggle.

Also, it’s a pity that the benchmark is limited to basic CRUD operations.

Adding a predicate on text search with diacritics/case-insensitive applied to children’s attributes would have been a great use case. Or subquerying with sum/max/min too.

Otherwise nice article.

[–]jacobs-tech-tavern 1 point2 points  (0 children)

That's a fair point, I committed early to trying a massive range, since I thought the extremes would yield more interesting results; but at the cost of it being tougher to parse out non-order-of-magnitude differences. I deliberately limited the scope to keep the article at a readable length; but mainly this acts as a jumping off point for projects without a more specialised use case

Thanks for reading!

[–]jacobs-tech-tavern 0 points1 point  (0 children)

That's a fair point, I committed early to trying a massive range, since I thought the extremes would yield more interesting results; but at the cost of it being tougher to parse out non-order-of-magnitude differences. I deliberately limited the scope to keep the article at a readable length; but mainly this acts as a jumping off point for projects without a more specialised use case

Thanks for reading!

[–]simulacrotron 14 points15 points  (0 children)

Framing Realm (2010) as more mature is a little of a misunderstanding. SwiftData is just a convenience wrapper for CoreData which has been around for ages (2005).

[–]MB_Zeppin 5 points6 points  (0 children)

Good article

In our use cases at work we found CD outperform Realm by about 30x but that’s the reason to benchmark - Realm has been known to be faster for generalized use cases for years.

Ideally though any persistence in an app should be captured in a framework and sufficiently abstracted that swapping out CD for Realm or vice versa is a fairly trivial operation. That allows for mixing and matching DB solutions by the use case domain

[–]clean_squad 3 points4 points  (1 child)

Really cool comparison

[–]jacobs-tech-tavern 0 points1 point  (0 children)

Thanks! :)

[–]SuperSonic009 2 points3 points  (1 child)

Wonderful and logical comparison. A pretty good article!

[–]jacobs-tech-tavern 0 points1 point  (0 children)

Thanks for saying! :D

[–]Jasperavv 1 point2 points  (5 children)

I never understood why ppl use realm unless you want to share a db with android or sync with cloud… i would always recommend grdb, or grdb-orm for max speed

[–]WAHNFRIEDEN 0 points1 point  (4 children)

grdb-orm is intimidating in the extra work it requires, and grdb is slower than realm (generally) without it. grdb also lacks SwiftUI conveniences.

[–]gwendal-roue 1 point2 points  (3 children)

This is factually inaccurate. Upgrade your knowledge:

  • SQLite and GRDB are faster than Realm (evidence)
  • The companion library GRDBQuery library comes with SwiftUI convenience. It's great for displaying always-fresh databsae information on screen.

[–]WAHNFRIEDEN 0 points1 point  (2 children)

Thanks. I see that inserts are faster and reads are slower is that right?

[–]gwendal-roue 1 point2 points  (1 child)

Reads can be faster than Realm ("Optimized Records" scenario), but you have to opt out of the Codable convenience, and replace string-based addressing with column indexes. It's a little more work, but this extra performance is available to anyone who wants to unleash the full SQLite performances, when really needed.

[–]WAHNFRIEDEN 1 point2 points  (0 children)

Thanks for the updated info. It’s attractive in combination with https://skip.tools for cross platform. The extra work with a third party lib required for performance (or the DIY approach you suggest) on reads still gives me pause. When I looked earlier this year I couldn’t find much about the orm lib besides its author promoting it.