SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
Android Overview                    Native code for Android        Benchmarking




           Developing and Benchmarking Native Linux
                    Applications on Android

                Leonid Batyuk Aubrey-Derrick Schmidt
         Hans-Gunther Schmidt Ahmet Camtepe Sahin Albayrak

                        DAI-Labor, Technische Universität Berlin


             The Second International ICST Conference on MOBILe
                Wireless MiddleWARE, Operating Systems, and
                              Applications, 2009
Android Overview                  Native code for Android   Benchmarking




Outline

      1     Android Overview
              What is Android?
              How does it work?
              The Dalvik VM
      2     Native code for Android
              Scope
              Important facts
              Techniques
      3     Benchmarking
              Performance issues
              Benchmarking set-up
              Results
              Conclusions
Android Overview                  Native code for Android   Benchmarking




Outline

      1     Android Overview
              What is Android?
              How does it work?
              The Dalvik VM
      2     Native code for Android
              Scope
              Important facts
              Techniques
      3     Benchmarking
              Performance issues
              Benchmarking set-up
              Results
              Conclusions
Android Overview          Native code for Android           Benchmarking


What is Android?


What is Android?



                   Android is an open-source OS for mobile
                   internet devices
                   Android is being driven by the Open Handset
                   Alliance, including Google, HTC, T-Mobile,
                   Samsung, Sony-Ericsson, Motorola and
                   others
                   Android is tageted at, but not limited to
                   smartphones. It is supposed for all kinds of
                   mobile devices, including netbooks
Android Overview                         Native code for Android                Benchmarking


How does it work?


How does it work?



                                           Android comprises of:
                    Application                    Linux kernel
          Application Framework
                                                   Modified BSD libc (bionic)
                                                   Stripped-down unixoid userland
        Libraries            Dalvik VM
                                                   Custom object oriented IPC
                    Linux kernel                   (OpenBinder)
                                                   Custom Java VM (Dalvik)
Android Overview                 Native code for Android               Benchmarking


How does it work?


Development of Android applications

                          Developers are intended to create
           Manifest file   applications in Java
        Dalvik bytecode   An SDK is provided by Google
                              Emulator
                              Eclipse plugin
            GUI styles
                              Debugging utilities
            GUI layout    An application is packaged for distribution in
                          an APK file, which contains:
           Localization       Bytecode
                              Manifest file describing the capabilities etc.
            Resources
                              Various application resources
               APK        Distribution is possible, but not restricted to,
                          the Android Market.
Android Overview          Native code for Android           Benchmarking


The Dalvik VM


The Dalvik VM



                   Custom Java VM developed by Google
                   Uses its own bytecode, not Java bytecode
                   Each application runs in its own VM instance
                   for security reasons
                   Register-based, optimized for small footprint
                   Lacks Just-In-Time compilation and other
                   common optimizations, therefore not
                   performant
Android Overview                 Native code for Android             Benchmarking


The Dalvik VM




      Why not speed-up using native code?
      Using native code is still not supported, but is expected to
      become part of the SDK by the end of the year.

      Google says:
      [...] C/C++ code [...] easily runs 10-100x faster than doing the
      same thing in a Java loop.
Android Overview                 Native code for Android             Benchmarking


The Dalvik VM




      Why not speed-up using native code?
      Using native code is still not supported, but is expected to
      become part of the SDK by the end of the year.

      Google says:
      [...] C/C++ code [...] easily runs 10-100x faster than doing the
      same thing in a Java loop.
Android Overview                  Native code for Android   Benchmarking




Outline

      1     Android Overview
              What is Android?
              How does it work?
              The Dalvik VM
      2     Native code for Android
              Scope
              Important facts
              Techniques
      3     Benchmarking
              Performance issues
              Benchmarking set-up
              Results
              Conclusions
Android Overview                    Native code for Android           Benchmarking


Scope


Scope


        What is a good reason to use native code?
              Speed up heavy computational tasks
              Time-critical applications
              Running a daemon outside of the application lifecycle

        Out of scope:
              100% native applications are impossible since the UI runs
              in Dalvik
              Porting big and powerful software like Snort or MySQL is
              unfeasible due to linking issues
Android Overview                    Native code for Android           Benchmarking


Scope


Scope


        What is a good reason to use native code?
              Speed up heavy computational tasks
              Time-critical applications
              Running a daemon outside of the application lifecycle

        Out of scope:
              100% native applications are impossible since the UI runs
              in Dalvik
              Porting big and powerful software like Snort or MySQL is
              unfeasible due to linking issues
Android Overview                   Native code for Android                 Benchmarking


Important facts


Important facts

            Manifest file
                            Toolchain
         Dalvik bytecode         Code Sourcery G++ (G++-like toolchain)
                                 Scratchbox (ARM emulation with a toolchain)
           Native binary    Different page alignment
                                 Dynamic linking becomes difficult
           Native library
                                 Static linking preferred for standalone
             GUI styles
                                 executables
                            Packaging
             GUI layout          If you want a UI, make your native code a
                                 part of an APK
            Localization
                            Size limit
             Resources           Any raw resource which is packaged inside
                                 an APK may not exceed 1Mb
                  APK
Android Overview                Native code for Android   Benchmarking


Techniques


Techniques




      JNI
      Java Native Interface

      Pipes
      Traditional unixoid IPC via FIFOs
Android Overview                      Native code for Android            Benchmarking


Techniques


JNI


       Java class
                               JNI - Java Native Interface
         method
                               Widely accepted in the Java ecosystem
         method
                               (Eclipse, SWT)
         native method stub
                               Widely used in the Android OS
    Java                       implementation
    Native                     Currently not supported in the SDK, but
                               planned
             native function
                               Runs in same thread, no process is being
       C library               spawned
Android Overview                              Native code for Android          Benchmarking


Techniques


Pipes

       Java class
                                       FIFO - first in, first out
         method
                                       Widely used for simple IPC on unixoid
         native method stub            systems
                                       Java uses a named pipe to communicate to a
                   Java I/O
    Java                               standalone native executable
        FIFO                    FIFO   Java I/O is extremely expensive on Android
    Native                             and thus a bottleneck
                   Native I/O
                                       Runs in its own thread, can be made a
                                       daemon
             native function
                                       This allows us to avoid the standard
       C library                       application lifecycle
Android Overview                  Native code for Android   Benchmarking




Outline

      1     Android Overview
              What is Android?
              How does it work?
              The Dalvik VM
      2     Native code for Android
              Scope
              Important facts
              Techniques
      3     Benchmarking
              Performance issues
              Benchmarking set-up
              Results
              Conclusions
Android Overview                                    Native code for Android                  Benchmarking


Performance issues


Performance of the Sun JVM

                                                 Linux x86 PC (for comparison)




                                    1.5
                     Time elapsed [ms]




                                         1



                                    0.5


                                                                               Sun JRE 1.6
                                         0                                     gcc -O3
                                             0          2,000                 4,000
                                                           Array size
Android Overview                                       Native code for Android           Benchmarking


Performance issues


Performance issues of the Dalvik VM

                                                          Android emulator

                                                  Dalvik VM
                                                  Android C
                     Time elapsed [ms]




                               100




                                         50




                                         0

                                              0            2,000                 4,000
                                                              Array size
Android Overview                    Native code for Android           Benchmarking


Performance issues


Performance issues of the Dalvik VM




      Dalvik performance problems
              No Just-in-Time compilation
              Optimized for small footprint, not raw performance
              Java I/O (java.io) and built-in functions relatively slow
Android Overview             Native code for Android           Benchmarking


Benchmarking set-up


Microbenchmarking approach



                      Microbenchmarking focuses on small and
                      uncomplicated benchmarks
                      Measuring the performance of the basic
                      computing operations
                      Not intended to rate the overall performance
                      of the system
                      Not measuring the responsiveness of the UI
                      or the I/O speed
Android Overview                    Native code for Android       Benchmarking


Benchmarking set-up


Benchmark set-up


              Heapsort in Java
              Heapsort in a daemon which listenes to a FIFO
              Heapsort in a JNI library
              Built-in Java method for sorting arrays
              Built-in Java method for sorting objects (PriorityQueue)
              Quicksort in Java

      Setup on Android and on a Linux PC
              Android: Code Sourcery gcc -O3 vs. Dalvik VM
              Linux: GNU Compiler Collection gcc -O3 vs. Sun JDK 1.6
Android Overview                    Native code for Android       Benchmarking


Benchmarking set-up


Benchmark set-up


              Heapsort in Java
              Heapsort in a daemon which listenes to a FIFO
              Heapsort in a JNI library
              Built-in Java method for sorting arrays
              Built-in Java method for sorting objects (PriorityQueue)
              Quicksort in Java

      Setup on Android and on a Linux PC
              Android: Code Sourcery gcc -O3 vs. Dalvik VM
              Linux: GNU Compiler Collection gcc -O3 vs. Sun JDK 1.6
Android Overview                                Native code for Android                             Benchmarking


Results


Results on Android

                                                Sorting Integers on Android




                              103
          Time elapsed [ms]




                              102


                                                                               pipe (using native Linux)
                              101
                                                                               plain Java heapsort (VM)
                                                                               PriorityQueue (VM)
                                                                               Java built-in (VM)
                              100                                              JNI (using native Linux)

                                    0   1,000       2,000            3,000    4,000           5,000
                                                           Array size
Android Overview                                   Native code for Android                            Benchmarking


Results


Results on a Linux system (for comparison)

                                         Sorting Integers on a Linux PC (for comparison)



                               101
          Time elapsed [ms]




                               100


                                                                                 pipe (using native Linux)
                              10−1                                               heapsort (VM)
                                                                                 PriorityQueue (VM)
                                                                                 Java built-in (VM)
                                                                                 JNI (using native Linux)
                              10−2
                                     0    1,000        2,000            3,000   4,000          5,000
                                                              Array size
Android Overview                    Native code for Android              Benchmarking


Conclusions


Conclusions for Android



              JNI is the fastest approach
              JNI is up to 10 times faster than plain Java
              Pipes are unfeasible for data-intensive tasks because of
              the expensive I/O
              Google should optimize Dalvik:
                   introduce JIT
                   implement computationally complex classpath methods
                   with JNI
Android Overview                    Native code for Android              Benchmarking


Conclusions


Conclusions for Android



              JNI is the fastest approach
              JNI is up to 10 times faster than plain Java
              Pipes are unfeasible for data-intensive tasks because of
              the expensive I/O
              Google should optimize Dalvik:
                   introduce JIT
                   implement computationally complex classpath methods
                   with JNI
Android Overview                    Native code for Android              Benchmarking


Conclusions


Conclusions for Android



              JNI is the fastest approach
              JNI is up to 10 times faster than plain Java
              Pipes are unfeasible for data-intensive tasks because of
              the expensive I/O
              Google should optimize Dalvik:
                   introduce JIT
                   implement computationally complex classpath methods
                   with JNI
Android Overview                    Native code for Android              Benchmarking


Conclusions


Conclusions for Android



              JNI is the fastest approach
              JNI is up to 10 times faster than plain Java
              Pipes are unfeasible for data-intensive tasks because of
              the expensive I/O
              Google should optimize Dalvik:
                   introduce JIT
                   implement computationally complex classpath methods
                   with JNI
Android Overview                 Native code for Android        Benchmarking


Conclusions


Future work




              Port a more common benchmark to Android (maybe
              LINPACK)
              Benchmark various handsets as they emerge during 2009
              Compare performance of Android to other mobile OSes on
              the same hardware
Android Overview    Native code for Android   Benchmarking


Conclusions




                   Thank you!

Mais conteúdo relacionado

Mais procurados

SachinBC_Resume
SachinBC_ResumeSachinBC_Resume
SachinBC_Resume
Sachin BC
 
Technical Architect on Embedded System.
Technical Architect on Embedded System.Technical Architect on Embedded System.
Technical Architect on Embedded System.
Prasad Roy Raju
 
Mobile App Dev with Atlassian
Mobile App Dev with AtlassianMobile App Dev with Atlassian
Mobile App Dev with Atlassian
Atlassian
 

Mais procurados (20)

SachinBC_Resume
SachinBC_ResumeSachinBC_Resume
SachinBC_Resume
 
Marakana Android Internals
Marakana Android InternalsMarakana Android Internals
Marakana Android Internals
 
Open Android
Open AndroidOpen Android
Open Android
 
Android For Managers Slides
Android For Managers SlidesAndroid For Managers Slides
Android For Managers Slides
 
Bhavin_Resume
Bhavin_ResumeBhavin_Resume
Bhavin_Resume
 
Android Beyond The Phone
Android Beyond The PhoneAndroid Beyond The Phone
Android Beyond The Phone
 
Android for Java Developers
Android for Java DevelopersAndroid for Java Developers
Android for Java Developers
 
Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010
 
Introduction to Module Development with Appcelerator Titanium
Introduction to Module Development with Appcelerator TitaniumIntroduction to Module Development with Appcelerator Titanium
Introduction to Module Development with Appcelerator Titanium
 
Technical Architect on Embedded System.
Technical Architect on Embedded System.Technical Architect on Embedded System.
Technical Architect on Embedded System.
 
DishitJoshi_CV
DishitJoshi_CVDishitJoshi_CV
DishitJoshi_CV
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
Scala on androids
Scala on androidsScala on androids
Scala on androids
 
Android NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo NativoAndroid NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo Nativo
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
안드로이드 MediaPlayer & VideoView
안드로이드 MediaPlayer & VideoView안드로이드 MediaPlayer & VideoView
안드로이드 MediaPlayer & VideoView
 
2018 top ide's for andriod development
2018 top ide's for andriod development2018 top ide's for andriod development
2018 top ide's for andriod development
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and Tactics
 
Mobile App Dev with Atlassian
Mobile App Dev with AtlassianMobile App Dev with Atlassian
Mobile App Dev with Atlassian
 

Semelhante a Developing and-benchmarking-native-linux-applications-on-android

2011 android
2011 android2011 android
2011 android
vpedapolu
 
Android Annotations and RoboGuice
Android Annotations and RoboGuiceAndroid Annotations and RoboGuice
Android Annotations and RoboGuice
Joel Sticha
 
Mono for Android Development
Mono for Android DevelopmentMono for Android Development
Mono for Android Development
Thinslices
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Farhad
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Farhad
 
Droid con 2012 bangalore v2.0
Droid con 2012   bangalore v2.0Droid con 2012   bangalore v2.0
Droid con 2012 bangalore v2.0
Premchander Rao
 
Mobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdfMobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdf
AbdullahMunir32
 
Android 110521210945-phpapp01
Android 110521210945-phpapp01Android 110521210945-phpapp01
Android 110521210945-phpapp01
Mona AlRekabi
 
Droid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtimeDroid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtime
Droidcon Berlin
 

Semelhante a Developing and-benchmarking-native-linux-applications-on-android (20)

2011 android
2011 android2011 android
2011 android
 
Android_Studio_Structure.docx
Android_Studio_Structure.docxAndroid_Studio_Structure.docx
Android_Studio_Structure.docx
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDK
 
Android Annotations and RoboGuice
Android Annotations and RoboGuiceAndroid Annotations and RoboGuice
Android Annotations and RoboGuice
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for android
 
Mono for Android Development
Mono for Android DevelopmentMono for Android Development
Mono for Android Development
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development Kit
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
 
Is Java Required for Android App Development.pdf
Is Java Required for Android App Development.pdfIs Java Required for Android App Development.pdf
Is Java Required for Android App Development.pdf
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android development
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
 
Droid con 2012 bangalore v2.0
Droid con 2012   bangalore v2.0Droid con 2012   bangalore v2.0
Droid con 2012 bangalore v2.0
 
Introduction to Mobile Development
Introduction to Mobile DevelopmentIntroduction to Mobile Development
Introduction to Mobile Development
 
Google Android @ AlphaCSP's JavaEdge
Google Android @ AlphaCSP's JavaEdgeGoogle Android @ AlphaCSP's JavaEdge
Google Android @ AlphaCSP's JavaEdge
 
Mobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdfMobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdf
 
Android 110521210945-phpapp01
Android 110521210945-phpapp01Android 110521210945-phpapp01
Android 110521210945-phpapp01
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android Programming
 
Droid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtimeDroid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtime
 
Android introduction
Android introductionAndroid introduction
Android introduction
 

Developing and-benchmarking-native-linux-applications-on-android

  • 1. Android Overview Native code for Android Benchmarking Developing and Benchmarking Native Linux Applications on Android Leonid Batyuk Aubrey-Derrick Schmidt Hans-Gunther Schmidt Ahmet Camtepe Sahin Albayrak DAI-Labor, Technische Universität Berlin The Second International ICST Conference on MOBILe Wireless MiddleWARE, Operating Systems, and Applications, 2009
  • 2. Android Overview Native code for Android Benchmarking Outline 1 Android Overview What is Android? How does it work? The Dalvik VM 2 Native code for Android Scope Important facts Techniques 3 Benchmarking Performance issues Benchmarking set-up Results Conclusions
  • 3. Android Overview Native code for Android Benchmarking Outline 1 Android Overview What is Android? How does it work? The Dalvik VM 2 Native code for Android Scope Important facts Techniques 3 Benchmarking Performance issues Benchmarking set-up Results Conclusions
  • 4. Android Overview Native code for Android Benchmarking What is Android? What is Android? Android is an open-source OS for mobile internet devices Android is being driven by the Open Handset Alliance, including Google, HTC, T-Mobile, Samsung, Sony-Ericsson, Motorola and others Android is tageted at, but not limited to smartphones. It is supposed for all kinds of mobile devices, including netbooks
  • 5. Android Overview Native code for Android Benchmarking How does it work? How does it work? Android comprises of: Application Linux kernel Application Framework Modified BSD libc (bionic) Stripped-down unixoid userland Libraries Dalvik VM Custom object oriented IPC Linux kernel (OpenBinder) Custom Java VM (Dalvik)
  • 6. Android Overview Native code for Android Benchmarking How does it work? Development of Android applications Developers are intended to create Manifest file applications in Java Dalvik bytecode An SDK is provided by Google Emulator Eclipse plugin GUI styles Debugging utilities GUI layout An application is packaged for distribution in an APK file, which contains: Localization Bytecode Manifest file describing the capabilities etc. Resources Various application resources APK Distribution is possible, but not restricted to, the Android Market.
  • 7. Android Overview Native code for Android Benchmarking The Dalvik VM The Dalvik VM Custom Java VM developed by Google Uses its own bytecode, not Java bytecode Each application runs in its own VM instance for security reasons Register-based, optimized for small footprint Lacks Just-In-Time compilation and other common optimizations, therefore not performant
  • 8. Android Overview Native code for Android Benchmarking The Dalvik VM Why not speed-up using native code? Using native code is still not supported, but is expected to become part of the SDK by the end of the year. Google says: [...] C/C++ code [...] easily runs 10-100x faster than doing the same thing in a Java loop.
  • 9. Android Overview Native code for Android Benchmarking The Dalvik VM Why not speed-up using native code? Using native code is still not supported, but is expected to become part of the SDK by the end of the year. Google says: [...] C/C++ code [...] easily runs 10-100x faster than doing the same thing in a Java loop.
  • 10. Android Overview Native code for Android Benchmarking Outline 1 Android Overview What is Android? How does it work? The Dalvik VM 2 Native code for Android Scope Important facts Techniques 3 Benchmarking Performance issues Benchmarking set-up Results Conclusions
  • 11. Android Overview Native code for Android Benchmarking Scope Scope What is a good reason to use native code? Speed up heavy computational tasks Time-critical applications Running a daemon outside of the application lifecycle Out of scope: 100% native applications are impossible since the UI runs in Dalvik Porting big and powerful software like Snort or MySQL is unfeasible due to linking issues
  • 12. Android Overview Native code for Android Benchmarking Scope Scope What is a good reason to use native code? Speed up heavy computational tasks Time-critical applications Running a daemon outside of the application lifecycle Out of scope: 100% native applications are impossible since the UI runs in Dalvik Porting big and powerful software like Snort or MySQL is unfeasible due to linking issues
  • 13. Android Overview Native code for Android Benchmarking Important facts Important facts Manifest file Toolchain Dalvik bytecode Code Sourcery G++ (G++-like toolchain) Scratchbox (ARM emulation with a toolchain) Native binary Different page alignment Dynamic linking becomes difficult Native library Static linking preferred for standalone GUI styles executables Packaging GUI layout If you want a UI, make your native code a part of an APK Localization Size limit Resources Any raw resource which is packaged inside an APK may not exceed 1Mb APK
  • 14. Android Overview Native code for Android Benchmarking Techniques Techniques JNI Java Native Interface Pipes Traditional unixoid IPC via FIFOs
  • 15. Android Overview Native code for Android Benchmarking Techniques JNI Java class JNI - Java Native Interface method Widely accepted in the Java ecosystem method (Eclipse, SWT) native method stub Widely used in the Android OS Java implementation Native Currently not supported in the SDK, but planned native function Runs in same thread, no process is being C library spawned
  • 16. Android Overview Native code for Android Benchmarking Techniques Pipes Java class FIFO - first in, first out method Widely used for simple IPC on unixoid native method stub systems Java uses a named pipe to communicate to a Java I/O Java standalone native executable FIFO FIFO Java I/O is extremely expensive on Android Native and thus a bottleneck Native I/O Runs in its own thread, can be made a daemon native function This allows us to avoid the standard C library application lifecycle
  • 17. Android Overview Native code for Android Benchmarking Outline 1 Android Overview What is Android? How does it work? The Dalvik VM 2 Native code for Android Scope Important facts Techniques 3 Benchmarking Performance issues Benchmarking set-up Results Conclusions
  • 18. Android Overview Native code for Android Benchmarking Performance issues Performance of the Sun JVM Linux x86 PC (for comparison) 1.5 Time elapsed [ms] 1 0.5 Sun JRE 1.6 0 gcc -O3 0 2,000 4,000 Array size
  • 19. Android Overview Native code for Android Benchmarking Performance issues Performance issues of the Dalvik VM Android emulator Dalvik VM Android C Time elapsed [ms] 100 50 0 0 2,000 4,000 Array size
  • 20. Android Overview Native code for Android Benchmarking Performance issues Performance issues of the Dalvik VM Dalvik performance problems No Just-in-Time compilation Optimized for small footprint, not raw performance Java I/O (java.io) and built-in functions relatively slow
  • 21. Android Overview Native code for Android Benchmarking Benchmarking set-up Microbenchmarking approach Microbenchmarking focuses on small and uncomplicated benchmarks Measuring the performance of the basic computing operations Not intended to rate the overall performance of the system Not measuring the responsiveness of the UI or the I/O speed
  • 22. Android Overview Native code for Android Benchmarking Benchmarking set-up Benchmark set-up Heapsort in Java Heapsort in a daemon which listenes to a FIFO Heapsort in a JNI library Built-in Java method for sorting arrays Built-in Java method for sorting objects (PriorityQueue) Quicksort in Java Setup on Android and on a Linux PC Android: Code Sourcery gcc -O3 vs. Dalvik VM Linux: GNU Compiler Collection gcc -O3 vs. Sun JDK 1.6
  • 23. Android Overview Native code for Android Benchmarking Benchmarking set-up Benchmark set-up Heapsort in Java Heapsort in a daemon which listenes to a FIFO Heapsort in a JNI library Built-in Java method for sorting arrays Built-in Java method for sorting objects (PriorityQueue) Quicksort in Java Setup on Android and on a Linux PC Android: Code Sourcery gcc -O3 vs. Dalvik VM Linux: GNU Compiler Collection gcc -O3 vs. Sun JDK 1.6
  • 24. Android Overview Native code for Android Benchmarking Results Results on Android Sorting Integers on Android 103 Time elapsed [ms] 102 pipe (using native Linux) 101 plain Java heapsort (VM) PriorityQueue (VM) Java built-in (VM) 100 JNI (using native Linux) 0 1,000 2,000 3,000 4,000 5,000 Array size
  • 25. Android Overview Native code for Android Benchmarking Results Results on a Linux system (for comparison) Sorting Integers on a Linux PC (for comparison) 101 Time elapsed [ms] 100 pipe (using native Linux) 10−1 heapsort (VM) PriorityQueue (VM) Java built-in (VM) JNI (using native Linux) 10−2 0 1,000 2,000 3,000 4,000 5,000 Array size
  • 26. Android Overview Native code for Android Benchmarking Conclusions Conclusions for Android JNI is the fastest approach JNI is up to 10 times faster than plain Java Pipes are unfeasible for data-intensive tasks because of the expensive I/O Google should optimize Dalvik: introduce JIT implement computationally complex classpath methods with JNI
  • 27. Android Overview Native code for Android Benchmarking Conclusions Conclusions for Android JNI is the fastest approach JNI is up to 10 times faster than plain Java Pipes are unfeasible for data-intensive tasks because of the expensive I/O Google should optimize Dalvik: introduce JIT implement computationally complex classpath methods with JNI
  • 28. Android Overview Native code for Android Benchmarking Conclusions Conclusions for Android JNI is the fastest approach JNI is up to 10 times faster than plain Java Pipes are unfeasible for data-intensive tasks because of the expensive I/O Google should optimize Dalvik: introduce JIT implement computationally complex classpath methods with JNI
  • 29. Android Overview Native code for Android Benchmarking Conclusions Conclusions for Android JNI is the fastest approach JNI is up to 10 times faster than plain Java Pipes are unfeasible for data-intensive tasks because of the expensive I/O Google should optimize Dalvik: introduce JIT implement computationally complex classpath methods with JNI
  • 30. Android Overview Native code for Android Benchmarking Conclusions Future work Port a more common benchmark to Android (maybe LINPACK) Benchmark various handsets as they emerge during 2009 Compare performance of Android to other mobile OSes on the same hardware
  • 31. Android Overview Native code for Android Benchmarking Conclusions Thank you!