How to speed up the module in AOSP

I am working on a contacts application from an Android open source project. The version for Android is 2.3.5_r1. And using mm to make the module, but the execution speed is rather slow, so I doubt if there is a way to speed up the creation.

PS: In fact, if I compile this module in eclipse, I speed up the litter, because the function is automatic build eclipse. But I don't like working with eclipse, so give it up.

+4
source share
3 answers

In order of least cost to you:

  • Do not do so clean. Allow the makefile to determine what to rebuild.
  • Use CCACHE export USE_CCACHE=1 . You will probably be able to see the effects of CCACHE after repeated recovery. If your project is large, set a higher CCACHE size, for example. 10GB ${ANDROID_DIR}/prebuilt/linux-x86/ccache/ccache -M 10G
  • Get a better processor and run with a higher -j option
+5
source

For example, I use the following command from the root folder of your Android project:

 mmm frameworks/base snod -j4 

And I think this is the best choice. Try it, but replace frameworks/base with your project name (relative path where Android.mk is stored).

+6
source

1. Assembly of modules + dependencies

mmma is slower than mmm , because the former check that all dependencies for the module match and if they do not compile them. So, initially, instead of the full make create dependencies for the module you are interested in using the following:

 mmma -j4 adir/yourmoduledir 

2. Assembly module

Now that the dependencies are satisfied, continue to recompile only the module you are interested in. Skipping dependency checks saves valuable time. However, the directory you use may contain more than one compilation target. To compile one goal, use something like:

 mmm -j4 adir/yourmoduledir:moduletargetname 

Example

Build libart

Create a library and all its dependencies once :
 mmma -j4 art/runtime 
Modify the libart code and quickly create it:
 mmm -j4 art/runtime:libart 

You will get half the compilation time compared to the approach of Yuri, since, for example, the debugging flavor of libart ( libartd ) will be completely omitted.

Further acceleration?

Of course you should enable caching as aultbot .

In addition, depending on the modules you are interested in, there may be compilation goals that you can disable by digging out makefiles. For example, libart compiled for both the host and the target. If you change the variable in makefiles, you can force compilation for only one of the two, which will save you half the time.

Additional Information:

+1
source

Source: https://habr.com/ru/post/1382808/


All Articles