Energy Consumption of Android Applications

A. Comparing Native versus PHPPerformance results achieved by the native and PHP im-plementations are summarized in Table I, in terms of av-erage execution time and standard deviation. These resultsare also illustrated in Fig. 8. The native implementationpresents the best results for execution time compared to PHPimplementation in all experimented scenarios (from 100 to10,000 elements). In the scenarios with 100, 1,000 and 10,000elements, native achieved execution times around 85% smallerthan the PHP implementation. This improvement decreases to30% in the scenario with 100,000 elements.Table II summarizes the energy consumption results forthe both evaluated implementations. The native implemen-tation achieves better results in scenarios with 100 (94%)and 1,000 (79%) elements. When the vector size is increasedto 10,000, the PHP implementation presents a reduction onenergy consumption around 15% compared to the native one.This improvement achieved by PHP implementation increasesto 83% with 100,000 elements.

B. Comparing Native versus JavaScript versus Node.jsThis section compares the efficiency of two JavaScriptimplementations for the sort application against each other andagainst the native implementation, regarding execution timeand energy consumption.Table III summarizes the performance results for thethree evaluated implementations given in miliseconds. Resultsachieved with 100 and 1,000 elements point out that thenative implementation presents the lowest execution timescompared to the JavaScript and the Node.js ones. Then, thenative approach achieves performance improvements around90% with 100 elements, and around 76% with 1,000 elements.However, when 10,000 elements are used, the native approachpresents only 18% of improvement compared to the JavaScriptimplementation and losing for the Node.js implementation thatachieved the lowest execution time.The Node.js implementation obtained the best performanceresults in the scenarios with large number of elements. With10,000 elements, this implementation achieves improvementsaround 21% against the native and 35% against the JavaScript.As the array size increases to 100,000 elements, the Node.jsimplementation presents improvements around 91% and 61%,against to native and JavaScript ones, respectively. Comparedto the JavaScript implementation, the Node.js one achieved thebest performance results in all experimented scenarios.

Energy consumption results achieved by the JavaScript,Node.js and the native implementations in the four experi-mented scenarios are summarized in Table IV. The native implementation presents the lowest consumption in the scenarioswith 100 and 1,000 elements, achieving improvements around99% and 94% against to the JavaScript implementation andNode.js one in scenarios with 100 and 1,000 elements, respec-tively. When the array size increases, the native approach losesefficiency, presenting the worst energy consumption comparedto the other both versions. The Node.js and the JavaScript im-plementations achieve statistically equivalent energetic resultsin the two small scenarios. However, with 10,000 and 100,000elements, the Node.js achieves improvements from 24% to93%, respectively, against to Javascript. Likewise, comparedto native, Node.js implementation also achieves improvementsfrom 43% and 98% in these larger scenarios.

C. Overall ComparisonThis section presents an overall analysis of performanceand energy consumption achieved by the four evaluated de-velopment approaches in the experimented scenarios. Code Shoppy These graphics are in a logarithm scale, sincethe axis X (array size) varies exponentially and thus, theseplots illustrate how this variation impacts on performance andenergy consumption.Regarding performance, one can observe in Fig. 12 that na-tive approach has the best results with the smaller arrays, whilethe Node.js presents the lowest execution time with the largestarrays, followed by the JavaScript one. This plot points out thatthe native approach is the most impacted by the array size andconsequently by the processing load. The accentuated curverepresenting native performance results means an exponentialgrowing, in the used scale. Although, PHP approach alsopresents an accentuated curve, it tends to grow more slowly.The performance results of both JavaScript implementationspresent the most softened curves. Thus, we can concludethat the performance of these both implementations are lessimpacted by the array size compared to the other approaches.Considering energy, as shown in Fig. 13, the native presentsthe lowest consumption with 100 elements, but the high-est consumption with 100,000. Using arrays of 10,000 and100,000 elements, the Node.js approach achieves the best en-ergy results, as well as the best performance. The efficiency, as energetic as temporal, achieved by native approach is the moreimpacted by the array size, compared to others. On the otherside, the Node.js version presents the energy consumptionless impacted by the arrays size and it is the best choice for largest scenarios regarding energy consumption as well asexecution time. Comparing JavaScript and Node.js curves, onecan observe that JavaScript curve is soft and similar do Node.jsuntil 10,000 elements, but after that, the impact is accentuated.PHP implementation presents the second best consumptionin the two smaller scenarios. As the array size increases,its impact on PHP energy consumption is accentuated. It isimportant to emphasize here that the both approaches thatadopt remote execution (PHP and Node.js) are the best choicesfor the highest experimented scenarios, due to migration ofprocessing to a server. However, the Node.js achieves animprovement of 88% against PHP with 100,000 elements.

Mobile applications can be developed following a nativeapproach or a web-based approach. Web-based approacheshave been investigated once these turn easier to developapplications that can be executed in several devices, inde-pendently of the adopted OS. This work investigates theimpact of employment of different web-based approaches inthe execution time and energy consumption associated toa sort application. We consider a PHP, a JavaScript and aNode.js implementation, comparing them among each otherand against to a native implementation. Our experiments alsoexplore the processing load, varying the size of the array, aswell as evaluate approaches using local and remote execution.Our results indicate that native approach is the best one,regarding performance and energy until a certain processingload. Moreover, results points out that the efficiency of thenative approach is highly impacted by the processing load,and then this approach can be prohibitive for huge processingloads. As the array size to be sorted is significantly increased,the Node.js implementation presents the lower execution timesand the lower energy consumption. It is important to highlightalso that Node.js approach is the less impacted by the process-ing load, mainly regarding energy consumption.Among the cross-platform approaches, Node.js is the bestchoice for large processing load considering both metrics.In the lowest scenario, compared to Node.js, PHP approachpresents little better performance and a significant improve-ment in energy consumption. Both approaches adopt remoteexecution, and consequently, these reduce the consumptionthrough moving the processing to a server, which explainsthe improvements achieved by these approaches when largerarrays are used.Our experiments explore three web-based approaches, butnowadaysframeworksas Cordova [16] have been provided asan alternative to facilitate the mobile cross-platform develop-ment. As future work, we plan to evaluate also the efficiencyof the code generated by theseframeworks. Moreover, weplan to extend our study for a huge number of applicationsin order to observe how the application nature can impact onthe efficiency achieved by the different approaches.