简体   繁体   中英

How to improve performance of application in iOS?

I have developed an application which works on iPhone-3GS, iPhone-4, iPhone-4S.

For start up process, it take 30 seconds on iPhone-4s , and take 50-55 seconds on iPhone-3gs . Tested on same network.(Its not an issue related to network or internet; In simulator it took only 5 second. )

In this start up process, App performs several actions like deletion of old data from Database, WebService calling and inserting response data into Database. Application calls almost 8 web service on main thread using performSelectorOnMainThread method(sequentially) .

I am using SQLite and Compiled Query structure for insertion. I want to improve performance of application and want to reduce start up time taken by application.

Same back-end is used by Android team and they are also doing same thing. It takes 20 sec only on Galaxy note (Team android is using Object Relational Modal to communicate with Sqlite database ) .

Is this the reason for faster performance ?

Is there anything that work same as ORM in Java for Objective-C to improve performance while dealing with Sqlite (processor specific , less time consuming)?

First thing is you should not be doing network operations (web service calls) on the main thread. That should be done on background threads. I don't know enough about using SQLite directly but with CoreData you can make "database" updates on background threads and just use the main thread for merging the two ManagedObjectContexts .

I imagine moving your WS calls to background threads (AFNetworking is a great framework btw), that you will see lots of improvement.

One example I have is a web-service based app that gets 7000 records from a SQL Server DB and creates an NSArray (data comes in as JSON) and that process takes 7-10 seconds. I further minimize the impact on the user by doing my auto-authentication process at the same time.

30 seconds is too long to have the user wait on something IMO.

You can use below link for fast insertion of data. We used it for saving 50000 records which done in few sec which was done in minutes

Fast Insertion in database

14 best tips are available here Best Steps to increase performance of iOS App

In this tutorial, point 13 gives the info you required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM