Friday, February 28, 2014
About Android application performance problems
The software is customized client businesses, merchants upload information goods, gifts, promotions and other management systems in the background, then the client can see above, submit orders, exchange gifts. Now the test phase, the discovery process is very large power consumption, heat generation is very serious, it should be application performance problems. After a simple comparison, the power consumption is about 2 times of public comment.
The main logic is as follows:
1 resident has a background service to access the network through the service, and then return the data to the callback Activity in. Service thread loop about every 500ms (Thread.sleep (500)), if the current task is to access the network have access to the data, otherwise it will do nothing and continue the cycle.
2 Use HttpClient request data, the server returns JSON data, analyze, and display.
Content 3. Portion of the page is stored in the local database, while the picture into SD card. When re-entering the page, if not directly read local data network, if the network is properly request the network, and then update the local data, and then read the local data is displayed.
4 main interface using TabHost plus Fragment achieved.
Great God, please help analyze, those places might cause a greater impact application performance? Or recommend, what tools can be used to detect what program performance.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Average power consumption of a large personal opinion is the following reasons
A lot of data in the service logic can be passed to the client-side processing, client processing logic power.
2 client starts a lot of threads, the thread is not only occupy memory, and CPU scheduling needs.
3 a number of instances of the client object is not released.
4 client used some complex logic calculations are not suitable for handling JAVA, JNI C code should be placed in the handle.
If background service is particularly complex, it opens a separate process handled by Binder transmit data. Reduce the burden on the client process.
Reply:
http://mobile.51cto.com/android-229128.htm
Reply:
Average power consumption is caused due to network interaction too frequently, you can think of ways to try to reduce the number of network interactions.
Reply:
From your description of the analysis, it should be too frequent cause of network requests.
The first interval to extend the network request to see the results.
The second guarantee request time constant, the other operation is not performed.
This should be able to compare the results.
Reply:
Smart phone to access the network when power consumption is amazing, so your program should be the access to the network tinkering update, and then have your data requested are not so big?
Reply:
Optimizing a problem
Reply:
The first problem is certainly there, because the content of many interfaces are not standardized, the client was forced to do a lot of string manipulation, determine the type, count, etc., do not know to what extent these logic would affect performance?
Several back for my program should not be a problem.
Reply:
This can not reduce ah, almost every page needs to request data, even if some of the data is stored locally, and still to this page when the judgment was requested data networking updates, and then update the local database. If the data is not updated, then do not re-download images of (the data stored in the database as well as picture into the SD card). I do not know this design worth?
Reply:
Maybe I was not clear it, that Thread.sleep (500) thread has been running, but not always in the requested data. If no request task data, then it is equivalent to an empty circle, two times per second. This will cost electricity in the extent of it? Also, I was put into this thread with no wait when the task the way, has the task when notify, as if nothing results.
Reply:
1. The amount of data transfer over the interface is large? Or if time is too long to resolve complex data structures.
Average power consumption is too much to networking operations, such as data can do an interface to obtain, but need three interfaces to the data read.
Reply:
For example, the application of a product list page, click on the list of goods into the product detail page.
So, is made of two interfaces, two pages were requested data is good? Or make an interface in the list of goods directly to the product details page returns come better?
Reply:
Do 2 interface for easy expansion. Also make a trip.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment