O'Reilly logo

Pro Android Apps Performance Optimization by Hervé Guihot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Assembly

The NDK allows you to use C and C++ in your Android applications. Chapter 2 showed you what native code would look like after the C or C++ code is compiled and how you could use objdump –d to disassemble a file (object file or library). For example, the ARM assembly code of computeIterativelyFaster is shown again in Listing 3–1.

Listing 3–1. ARM Assembly Code of C Implementation of computeIterativelyFaster

00000410 <computeIterativelyFaster>:  410:   e3500001       cmp     r0, #1  ;  0x1  414:   e92d0030       push    {r4, r5}  418:   91a02000       movls   r2, r0  41c:   93a03000       movls   r3, #0; 0x0  420:   9a00000e       bls     460 <computeIterativelyFaster+0x50>  424:   e2400001       sub     r0, r0, #1     ; 0x1  428:   e1b010a0       lsrs    r1, r0, #1 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required