TY - JOUR
T1 - On Haskell and energy efficiency
AU - Lima, Luís Gabriel
AU - Soares-Neto, Francisco
AU - Lieuthier, Paulo
AU - Castor, Fernando
AU - Melfe, Gilberto
AU - Fernandes, João Paulo
N1 - Publisher Copyright:
© 2018 Elsevier Inc.
PY - 2019/3
Y1 - 2019/3
N2 - Background: Recent work has studied diverse affecting factors on software energy efficiency. Objective: This paper attempts to shed light on the energy behavior of programs written in a lazy, purely functional programming language, Haskell. Methodology: We conducted two in-depth and complementary studies to analyze the energy efficiency of programs from two different perspectives: strictness and concurrency. Results: We found that small changes can make a big difference. In one benchmark, under a specific configuration, choosing the MVar data sharing primitive over TMVar can yield 60% energy savings. In another benchmark, TMVar can yield up to 30% savings over MVar. Thus, tools that support developers in refactoring a program to switch between primitives can be very useful. In addition, the relationship between energy consumption and performance is not always clear. In sequential benchmarks, high performance is an accurate proxy for low energy consumption. However, for one of our concurrent benchmarks, the variants with the best performance also exhibited the worst energy consumption. We report on deviating cases. Conclusions: To support developers, we have extended existing performance analysis tools to also gather and present data about energy consumption. Furthermore, we provide a set of guidelines to help Haskell developers save energy.
AB - Background: Recent work has studied diverse affecting factors on software energy efficiency. Objective: This paper attempts to shed light on the energy behavior of programs written in a lazy, purely functional programming language, Haskell. Methodology: We conducted two in-depth and complementary studies to analyze the energy efficiency of programs from two different perspectives: strictness and concurrency. Results: We found that small changes can make a big difference. In one benchmark, under a specific configuration, choosing the MVar data sharing primitive over TMVar can yield 60% energy savings. In another benchmark, TMVar can yield up to 30% savings over MVar. Thus, tools that support developers in refactoring a program to switch between primitives can be very useful. In addition, the relationship between energy consumption and performance is not always clear. In sequential benchmarks, high performance is an accurate proxy for low energy consumption. However, for one of our concurrent benchmarks, the variants with the best performance also exhibited the worst energy consumption. We report on deviating cases. Conclusions: To support developers, we have extended existing performance analysis tools to also gather and present data about energy consumption. Furthermore, we provide a set of guidelines to help Haskell developers save energy.
KW - Energy efficiency
KW - Functional programming
KW - Haskell
UR - http://www.scopus.com/inward/record.url?scp=85059519783&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85059519783&partnerID=8YFLogxK
U2 - 10.1016/j.jss.2018.12.014
DO - 10.1016/j.jss.2018.12.014
M3 - Article
AN - SCOPUS:85059519783
SN - 0164-1212
VL - 149
SP - 554
EP - 580
JO - Journal of Systems and Software
JF - Journal of Systems and Software
ER -