2017 IEEE 41st Annual Computer Software and Applications Conference

What Makes Software Energy-Efﬁcient?
Make It Faster
Hiroyuki Matsuo, Shinsuke Matsumoto and Shinji Kusumoto
Graduate School of Information Science and Technology, Osaka University, Japan
Email: {h-matsuo, shinsuke, kusumoto}@ist.osaka-u.ac.jp
H2 There is a slight correlation between total energy consumption and memory usage.
The hypothesis H1 is equivalent to the previous question. In
the hypothesis H2 , we try to conﬁrm that energy consumption
cannot be completely predicted only by duration; usage ofhardware resources may affect on it. In this paper, we measurea memory usage as one of the computational resources.

Abstract—In order to reduce software energy consumption, alot of studies have been carried out focusing on the differenceof implementation, such as API and algorithm. However, wehypothesize that there is a strong correlation between total energy
consumption of a program and duration of its execution. If thishypothesis is correct, reducing energy consumption is equal todecreasing duration. Experimental results reveal that there isa strong positive correlation between them, and its correlation
coefﬁcient is higher than 0.9. We also ﬁnd that memory usage
is weakly correlated with total energy consumption. As a result,
we conclude that if developers want to reduce software energy
consumption, they should ﬁrstly decrease duration of execution,and secondly reduce memory usage.
Index Terms—energy consumption, software, program, sorting
algorithm, Java Collections class.

II. R ELATED W ORKS
Many studies have been carried out on the topic of energy
consumption of software at a source code level. Bunse etal. studied differences in energy consumption between major
sorting algorithms [2]. Their conclusion is that insertion sortis the most energy-efﬁcient. Hasan et al. conducted an experimental study on energy consumption of usual API operations
for popular Java Collections classes [3]. They concluded that
TIntArrayList is the most energy-efﬁcient list implementation.
From a perspective of a duration of program execution andits energy consumption, their conclusions seem to be contrary
to each other. While, Bunse’s study mentioned that there are nodirect correlations between duration and total energy consumption, Hasan’s study pointed out that increase in duration (i.e.,low performance) may be a degradation factor for energy consumption. We consider that this contradiction may be derived
from a difference of their experimental environments. Bunseet al. measured only a CPU’s energy consumption, however,Hasan et al. measured whole hardware devices embedded in anAndroid device. For a practical purpose, we need to conduct
a replication study under the same conditions.
In addition, Hasan’s study gives only a discussion of a relation between duration and energy consumption. Their focus
is only on a comparative study of Java Collections classes, so
empirical and quantitative results of the relation have not beenreported. They also concluded more investigation is required.
Based on the above discussion, we decide to conduct anadditional study based on their two experiments under thefollowing conditions:• Measure a total energy consumption which is consumed
by not only a CPU but the whole device.
• Measure a duration of program execution as well as a
total energy consumption.

I. I NTRODUCTION
There have been several studies for optimizing or savingenergy consumption of software at an implementation level.
Our fundamental question here is follows. Do any dominantfactors exist that affect program energy consumption rather
than duration of program execution? In general, every hardware device consumes energy steadily during its operation. We
assume that if a program accomplishes in a shorter period oftime, its energy consumption will be certainly reduced. The usage of computational hardware resources (e.g., memory, harddrive and Wi-Fi) differs depending on implementation of aprogram. However, we believe that a difference of the resource
usage cannot be a dominant factor of energy consumption;
duration affects energy consumption signiﬁcantly.
If the above hypothesis is correct, an emerging challenge
for program energy consumption can be simply solved byapplying techniques or tools which have already been achievedin a ﬁeld of program performance optimization. Furthermore,measuring energy consumption requires preparing for a special
environment such as GreenMiner [1]. On the other hand, if
our hypothesis is true, the duration of execution, which isextremely easy to measure, can be introduced as a substitutefor the special environment. This will be a useful fact for many
software developers.
In this paper, we empirically study a relationship between
total energy consumption of software and its duration. The
experimental objects are small programs which have the samefunctional features but are implemented in different ways (e.g.,
bubble sort and quick sort). The concrete hypotheses are as
follows:
H1 There is a signiﬁcant strong correlation between totalenergy consumption and duration.
0730-3157/17 $31.00 © 2017 IEEE
DOI 10.1109/COMPSAC.2017.264

III. E XPERIMENT
A. Experiment design
We adopt two types of experimental subjects according
to the related works [2] and [3]. The ﬁrst type is sorting
274






indicates total energy consumption [J] or memory usage [KB],respectively. Each point shows the measured data on each trial.
For example, one point in Figure 1(a) indicates a measurement
result about quick sort of 20th trial. The red dash line meansa regression line of each sample, and a calculated correlation
coefﬁcient r is also shown at the bottom right.
As a result, Figure 1 indicates that there is a signiﬁcantcorrelation between total energy consumption and duration.
A correlation coefﬁcient r is greater than 0.9 on both experimental objects, so there is a strong positive correlation
between them. We conclude that hypothesis H1 is supported.
This result indicates that duration of program execution can bea reliable metric to estimate its energy consumption without
any preparations for special devices. In fact, one of Hasan’sconclusions, the most energy-efﬁcient list implementation isTIntArrayList, can be derived from only y-axis (duration) ofFigure 1(b).
From Figure 2, memory usage has some variation comparedto duration. A correlation coefﬁcient r is about 0.7, so there
is a positive correlation between them. We conclude that
hypothesis H2 is supported.

$UUD\/LVW/LQNHG/LVW
7,QW$UUD\/LVW
7,QW/LQNHG/LVW
7UHH/LVWU'XUDWLRQ >PV@VHOHFWLRQVKDNHUEXEEOH
LQVHUWLRQ'XUDWLRQ >PV@KHDS
PHUJH
TXLFNU

(QHUJ\ &RQXPSWLRQ >-@(QHUJ\ &RQXPSWLRQ >-@(a) Sorting algorithms(b) Java Collections classesU(QHUJ\ &RQXPSWLRQ >-@(a) Sorting algorithms

  

$UUD\/LVW/LQNHG/LVW
7,QW$UUD\/LVW
7,QW/LQNHG/LVW
7UHH/LVWVHOHFWLRQVKDNHU

0HDQ 0HPRU\ 8VDJH >.%@

EXEEOHLQVHUWLRQ



KHDS
PHUJH
TXLFN



0HDQ 0HPRU\ 8VDJH >.%@Fig. 1. Relation between energy consumption and durationU(QHUJ\ &RQXPSWLRQ >-@(b) Java Collections classes

IV. D ISCUSSION AND C ONCLUSION

Fig. 2. Relation between energy consumption and memory usage

This paper studies a relationship between software energy
consumption and duration of execution time. Our experimental
results reveal that there is a strong correlation between them,so we conclude that software developers should make theirsoftware faster if they would like to reduce total energy
consumption. We also found that there is a positive correlation
between software energy consumption and memory usage,
however, it is much weaker compared to one about duration.
These results are obtained on a Raspberry Pi, as we havementioned. However, we think this trend can be also found on
both larger computers and smaller ones. In the former case,such as on the computers with many GPUs or frequent network
communications, there should be a marked tendency becausesuch computers consume more energy in a unit of time. In
the latter case, the smaller computers need less energy so weshould ﬁnd a weak trend on them.
As a future work, we will study a relationship between software energy consumption and other computational resources.
We are also going to conduct practical experiments to conﬁrm
whether this study results are applied to general software
libraries and applications.

algorithm. This type includes seven major algorithms: heap,
merge, quick, bubble, insertion, selection and shaker. The
second type is Java Collections classes which implement listinterface. This type also includes ﬁve Java classes: ArrayList,LinkedList, TIntArrayList, TIntLinkedList and TreeList. On
both of each type, these subjects have the same functionalfeatures but have the different implementations.
The following two experiments are conducted for eachexperimental subjects. In the ﬁrst experiment, total energy
consumption and duration are measured to conﬁrm the hypothesis H1 . We set a number of trials as 50. For sorting
algorithms, 5,000 random integers are set and sorted on eachtrial. For Java Collections classes, we insert 5,000 integers
at the middle of the list. The second experiment measures
total energy consumption and memory usage to conﬁrm thehypothesis H2 . The number of trials and program operations
are the same as the ﬁrst experiment. Please note that theresults will contain more noise in the latter experiment because
it requires an additional program execution for measuring amemory usage on a test-bed device.
Measurement infrastructure was built with reference toGreenMiner [1]. A Raspberry Pi device acts as a test-bed,and another Raspberry Pi device operates and measures thetest-bed.

ACKNOWLEDGMENT
This research was partially supported by JSPS Grant-in-Aidfor Scientiﬁc Research (JP25220003, JP26730155).
R EFERENCES

B. Results[1] A. Hindle et al., “Greenminer: A hardware based mining software
repositories software energy consumption framework,” in Proc. Working
Conf. Mining Softw. Repositories (MSR), 2014, pp. 12–21.
[2] C. Bunse et al., “Choosing the ”best” sorting algorithm for optimalenergy consumption,” in Proc. Int’l Conf. Softw. and Data Technologies(ICSOFT), vol. 2, 2009, pp. 199–206.
[3] S. Hasan et al., “Energy proﬁles of java collections classes,” in Proc. Int’l
Conf. Softw. Eng. (ICSE), 2016, pp. 225–236.

The experimental results are shown in Figure 1 and Figure
2. Figure 1 shows a scatter diagram of energy consumption
and duration. Figure 2 represents a scatter diagram of energy
consumption and memory usage. In each diagram, the verticalaxis indicates execution time [ms] and the horizontal axis

275