Simple SwiftData app exhibits excessive & persistent memory growth as items are added

[Submitted as FB14860454, but posting here since I rarely get responses in Feedback Assistant]

In a simple SwiftData app that adds items to a list, memory usage drastically increases as items are added. After a few hundred items, the UI lags and becomes unusable.

In comparison, a similar app built with CoreData shows only a slight memory increase in the same scenario and does NOT lag, even past 1,000 items.

In the SwiftData version, as each batch is added, memory spikes the same amount…or even increases! In the CoreData version, the increase with each batch gets smaller and smaller, so the memory curve levels off.

My Question

Are there any ways to improve the performance of adding items in SwiftData, or is it just not ready for prime time?

Example Projects

Here are the test projects on GitHub if you want to check it out yourself:

I should have added…

  • Xcode version: 15.4 (15F31d)
  • iOS target: 17.5
Simple SwiftData app exhibits excessive & persistent memory growth as items are added
 
 
Q