
EXAMENSARBETE INOM TEKNIK, GRUNDNIVÅ, 15 HP STOCKHOLM, SVERIGE 2017 A comparison between cross- compiler and native development for mobile applications THIMMY LARSSON JONAS WEDIN KTH SKOLAN FÖR DATAVETENSKAP OCH KOMMUNIKATION A comparison between cross-compiler and native development for mobile ap- plications THIMMY LARSSON & JONAS WEDIN Bachelor’s thesis in Computer Science Date: June 4, 2017 Supervisor: Michael Schliephake Examiner: Lennart Bladgren Swedish title: En jämförelse mellan multiplattforms-kompilator och standard utveckling för mobilapplikationer School of Computer Science and Communication ii Abstract Developing mobile applications for several platforms is a challenge for developers today. Supporting multiple applications with seperate code bases is expensive and time con- suming. To solve this problem the technique Cross-Compiler is available for developers. This thesis investigates the performance and developer experience between native appli- cations in Android and iOS and applications created with Cross-Compiler Xamarin. An application is defined and developed in order to test multiple hardware features on the different platforms. Test results shows that Xamarin and native each have their own ad- vantages, however, the overall conclusion is drawn that the advantages with Xamarin is superior to native development. iii Sammanfattning Utveckling av mobilapplikationer för flera platformar är en utmaning för dagens utveck- lare. Underhållning av flera applikationer med olika kodbaser är dyrt och tidskrävande. För att lösa det problemet så används Cross-Compiler. Den här uppsatsen undersöker prestanda och utvecklar-upplevelse mellan att utveckla nativa applikationer och applika- tioner utvecklade med Cross-Compiler Xamarin. En applikation är definerad och utveck- lad som testar olika hårdvarukomponenter på dom olika platformarna. Resultatet visar att Xamarin och nativa applikationer har olika fördelar, men den övergripande slutsatsen är att Xamarin är överlägsen nativ utveckling. v Abbreviation Explanation OS Operating System CPT Cross Platform Tools CC Cross Compiler API Application Programming Interface HTML Hyper-text Markup Language CSS Cascading Style Sheets IDE Integrated Development Environment OHA Open Handset Alliance DVM Dalvik Virtual Machine ART Android Runtime IL Intermediate Language JIT Just-In-Time (compilation) AOT Ahead-Of-Time (compilation) SDK Software Development Kit APK Android Application Package UI User Interface ARM Advanced RISC Machine (processor architecture) NuGet Package manager for .NET platform GPU Graphics Processing Unit CPU Central Processing Unit JSON Javascript Object Notation URL Uniform Resource Locator (web-address) Contents Contents vi List of Figures viii 1 Introduction 1 1.1 Problem statement . .1 1.2 Scope . .2 1.3 Purpose . .2 2 Background 4 2.1 Cross-Platform Tools . .4 2.1.1 Web . .4 2.1.2 Hybrid . .5 2.1.3 Interpreter . .5 2.1.4 Cross-Compiler . .5 2.2 Operating Systems . .6 2.2.1 Android . .6 2.2.2 iOS . .9 2.3 Xamarin . 10 2.4 Related Work . 11 2.5 Trepn Profiler . 12 2.6 Instruments . 12 3 Method 13 3.1 What hardware to test . 13 3.2 Implementation process . 14 3.3 Testing process . 16 3.4 Development experience . 16 3.4.1 IDE experience . 17 3.4.2 Documentation & Language . 18 3.4.3 Learning curve . 19 4 Result 20 4.1 Developer experience . 20 4.1.1 iOS - Xcode . 20 4.1.2 Android - Android Studio . 21 4.1.3 Xamarin - Xamarin Studio . 23 vi CONTENTS vii 4.1.4 Summary . 25 4.1.5 Learning curve . 25 4.2 Test results . 26 4.2.1 Android . 26 4.2.2 iOS . 34 5 Discussion 46 5.1 Future work . 48 6 Conclusion 49 Bibliography 50 A Test Implementations 53 A.1 Bubble sort . 53 A.2 Finding primarys . 54 A.3 Copy lists . 55 A.4 Http request . 56 A.5 Server implementation . 57 A.5.1 JSON response . 57 A.5.2 Images . 58 B Http results data for iPhone 6 without Instruments 59 List of Figures 2.1 OS market shares . .6 2.2 Android stack . .7 2.3 Android version distribution . .8 2.4 Android compile process . .9 2.5 iOS version distrubution . 10 3.1 Work flow in applications . 15 4.1 Comparing Android and Xamarin for Bubble Sort . 27 4.2 Result table for Bubble sort on Android . 27 4.3 Comparing Android and Xamarin for Copy lists . 28 4.4 Result table for copy lists on Android . 28 4.5 Comparing Android and Xamarin for Copy lists for all 10 runs . 29 4.6 Comparing Android and Xamarin for finding primes . 29 4.7 Result table for finding primes on Android . 30 4.8 Comparing Android and Xamarin for Http requests . 30 4.9 Result table for http requests on Android . 31 4.10 Comparing Android and Xamarin and the total running time . 31 4.11 Result table for total running times on Android . 32 4.12 Comparing Android and Xamarin with regard to application size . 32 4.13 Result table for application size on Android . 32 4.14 Comparing Android and Xamarin with regard to lines of code . 33 4.15 Result table for code size on Android . 33 4.16 Used memory comparison for Android and Xamarin . 34 4.17 Result table for memory usage on Android . 34 4.18 Comparing native iOS and Xamarin iOS for Bubble Sort . 35 4.19 Result table for Bubble sort on iOS . 35 4.20 Comparing iOS and Xamarin for Copy lists with instruments running in back- ground . 36 4.21 Result table for copy lists on iOS . 36 4.22 Comparing iOS and Xamarin for Copy lists for all 10 runs . 37 4.23 Comparing iOS and Xamarin for finding primes with instruments running in background . 38 4.24 Result table for finding primes on iOS . 38 4.25 Comparing iOS and Xamarin for finding primes for all 10 runs . 39 4.26 Comparing iOS and Xamarin for Http requests with instruments running in background . 40 viii LIST OF FIGURES ix 4.27 Result table for http requests on iOS . 40 4.28 Comparing iOS and Xamarin and the total running time with instruments run- ning in background . 41 4.29 Result table for Total running time on iOS . 41 4.30 Comparing Android and Xamarin with regard to application size . 42 4.31 Result table for application size on iOS . 42 4.32 Comparing iOS and Xamarin with regard to lines of code . 43 4.33 Result table for code size on iOS . 43 4.34 Used memory (dirty) comparison for iOS and Xamarin . 44 4.35 Used memory (residential) comparison for iOS and Xamarin . 44 4.36 Result table for memory usage on iOS . 44 A.1 Native List View for Android and iOS . 56 Chapter 1 Introduction The mobile phone had the primary function of making phone calls, today on the other hand, multiple functions can be utilized with a smartphone. Today 90% of the time spent on the phone is in applications [29]. Facebook, Twitter, Instagram and Snapchat are a few of the most used applications where people can share their daily life to billions of users around the world. Applications have made the smartphone a critical companion to many people that they always keep with them. According to TechCrunch the smartphone has become more frequently used than desktops by the end of 2014 [11]. The growth in us- age of applications have increased the interest in mobile development since this is a mar- ket where capital can be earned. However, companies and developers that develop smartphone applications face a com- mon problem when deciding which platforms to support. The issue is that code and technology cannot be shared between platforms. There are a number of platforms avail- able on the market today: iOS, Android , Windows phone, Blackberry and some other minor OSs (Operating System) [16]. Developing native applications for each individual platform is time consuming and expensive for companies that want to reach all possible users have to develop specific application for each platform. Aspects such as develop- ment time, cost and maintenance, developing the same application for several platforms becomes expensive and time consuming. The need to maintain several platforms also re- quires that the developers posses a wide range of knowledge. To solve the problem numerous technologies have arisen in the last couple of years. These technologies allows development for multiple platforms simultaneously using the same code, so called Cross-platform tools (CPTs). CPTs aim to make the development process for multiple platforms easier because there is only one codebase to maintain and theoreti- cally that should lead to lesser bugs and cleaner code. 1.1 Problem statement This thesis examines the development of an application using two different techniques, native and cross-platform tools. Development is measured by two criteria, how perfor- mance is effected using the two different techniques and how development time and ex- 1 2 CHAPTER 1. INTRODUCTION perience differ between the techniques. Accordingly the problem statement for this thesis follows: “Is there an acceptable trade-off between performance and developer efficiency when building applications with cross-platform.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages74 Page
-
File Size-