The more modules The program starts, the faster it consumes power.
When you run a program that consumes only the CPU, the power consumption is minimal.
Of course, this is the best if the CPU is running slowly.
The program power consumption control first from the following 3 aspects of grasping:
1. Frequent I/O operations (starting local external enclosures and network communication modules)
2. Run too many threads at the same time (CPU module).
3. Frequent memory allocations and resulting memory fragmentation (frequent use of memory modules)
Reduce I/O operations:
If you are not connected to the WiFi or there is no available network, if not meet the conditions, do not start the network communication.
Use compression to reduce the data transferred in the network.
When reading and writing local text, you should choose a high-quality method implementation to reduce the read and write operations of external storage.
Use the appropriate cache to reduce I/O operations.
Run too many threads at the same time:
Not to million, do not easily go to the operation.
When you need to perform timed tasks, we recommend that we use Alarmmanager to start the service on a timed basis.
Alarmmanager is the use of hard wake technology when the target time is not reached and he is in hibernation
State.
Frequent memory allocations and the resulting memory fragmentation:
Singleton mode is recommended when an object needs to be used frequently in different modules.
Caching techniques are recommended when allocating memory frequently.