We are working on a legacy iPhone app that uses the awesome SQLPO to persist my objects to a sqlite database. The app doesn’t have a lot of data (100’s of rows) but, in our testing, believe that we are experiencing a bit of lag with SQLPO especially when inserting records.
So, I decided to run a super-simple benchmark to see whether the move to Core Data would be worth the pain.
I created two apps, each with a single class that would be persisted to the database several times over, one that used Core Data and another using SQLPO. The initial aim of the test was to compare these two frameworks on older iPhone hardware. But, after seeing the results on an iPhone 4, I didn’t feel the need to blow the dust off of my 1st Gen iPhone:
Time Test | SQLPO | Core Data |
---|---|---|
500 Record Insert | 27.5s | 0.43s |
500 Record Update | 15.13 sec | 0.44 sec |
10000 Record Insert | 360 sec* | 5.72 sec |
10000 Record Update | 300 sec* | 5.82 sec |
* Test did not finish. App crashed |
So, Core Data is faster, but does it perform better with memory usage? We noticed SQLPO was a bit liberal with its memory usage, so we were glad to see Core Data’s result:
Memory Test | SQLPO | Core Data |
---|---|---|
Max Live Bytes | 99.5 MB | 2.54 MB |
Idle Live Bytes | 3.02 MB | 1.74 MB |
Time to release | 63 sec | 1 sec |
Clearly a move to Core Data is the smart way to go and it had been on the to-do list for a future release. But, with these numbers, I think it may get a bump in priority.