On Haskell and energy efficiency

Abstract 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.

[1]  Da Young Lee A case study on refactoring in Haskell programs , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[2]  Anne E. Trefethen,et al.  Energy-aware software: Challenges, opportunities and strategies , 2013, J. Comput. Sci..

[3]  Simon L. Peyton Jones,et al.  Composable memory transactions , 2005, CACM.

[4]  Justyna Petke,et al.  Reducing Energy Consumption Using Genetic Improvement , 2015, GECCO.

[5]  Anne E. Trefethen,et al.  The Effect of Topology-Aware Process and Thread Placement on Performance and Energy , 2013, ISC.

[6]  Felipe Ebert,et al.  Mining Energy-Aware Commits , 2015, 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories.

[7]  Jácome Cunha,et al.  Energy efficiency across programming languages: how do energy, time, and memory relate? , 2017, SLE.

[8]  Gustavo Pinto,et al.  Understanding energy behaviors of thread management constructs , 2014, OOPSLA 2014.

[9]  Shirley Moore,et al.  Measuring Energy and Power with PAPI , 2012, 2012 41st International Conference on Parallel Processing Workshops.

[10]  Andrew P. Black,et al.  How we refactor, and how we know it , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[11]  Chris Okasaki,et al.  Purely functional data structures , 1998 .

[12]  Giuseppe Scanniello,et al.  On the Effect of Exploiting GPUs for a More Eco-Sustainable Lease of Life , 2015, Int. J. Softw. Eng. Knowl. Eng..

[13]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[14]  Yu David Liu,et al.  AEQUITAS: Coordinated Energy Management Across Parallel Applications , 2016, ICS.

[15]  Satnam Singh,et al.  Parallel performance tuning for Haskell , 2009, Haskell.

[16]  João Paulo Fernandes,et al.  Helping Developers Write Energy Efficient Haskell through a Data-Structure Evaluation , 2018, 2018 IEEE/ACM 6th International Workshop on Green And Sustainable Software (GREENS).

[17]  Lori L. Pollock,et al.  SEEDS: a software engineer's energy-optimization decision support framework , 2014, ICSE.

[18]  William G. J. Halfond,et al.  How Does Code Obfuscation Impact Energy Usage? , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[19]  Simon Marlow,et al.  There is no fork: an abstraction for efficient, concurrent, and concise data access , 2014, ICFP.

[20]  Victor Pankratius,et al.  A study of transactional memory vs. locks in practice , 2011, SPAA '11.

[21]  Tudor David,et al.  Everything you always wanted to know about synchronization but were afraid to ask , 2013, SOSP.

[22]  Benjamin C. Pierce,et al.  Type Operators and Kinding , 2002 .

[23]  Eli Tilevich,et al.  Reducing the Energy Consumption of Mobile Applications Behind the Scenes , 2013, 2013 IEEE International Conference on Software Maintenance.

[24]  João Paulo Fernandes,et al.  Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[25]  Vincent M. Weaver,et al.  A Validation of DRAM RAPL Power Measurements , 2016, MEMSYS.

[26]  Gustavo Pinto,et al.  A Comprehensive Study on the Energy Efficiency of Java's Thread-Safe Collections , 2016, ICSME.

[27]  Rahul Khanna,et al.  RAPL: Memory power estimation and capping , 2010, 2010 ACM/IEEE International Symposium on Low-Power Electronics and Design (ISLPED).

[28]  Huiqing Li,et al.  The Haskell Refactorer, HaRe, and its API , 2005, Electron. Notes Theor. Comput. Sci..

[29]  Chris Okasaki,et al.  An Overview of Edison , 2001, Haskell.

[30]  Efraim Rotem,et al.  Power-Management Architecture of the Intel Microarchitecture Code-Named Sandy Bridge , 2012, IEEE Micro.

[31]  Michael D. Ernst,et al.  How do programs become more concurrent ? A story of program transformations , 2008 .

[32]  Lori L. Pollock,et al.  How do code refactorings affect energy usage? , 2014, ESEM '14.

[33]  Fernando Castor Filho,et al.  A Study on the Energy Consumption of Android App Development Approaches , 2017, 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR).

[34]  Gabriele Bavota,et al.  Mining energy-greedy API usage patterns in Android apps: an empirical study , 2014, MSR 2014.

[35]  Hans-Wolfgang Loidl,et al.  ParaForming: Forming Parallel Haskell Programs Using Novel Refactoring Techniques , 2011, Trends in Functional Programming.

[36]  Hermann Härtig,et al.  Measuring energy consumption for short code paths using RAPL , 2012, PERV.

[37]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[38]  Gustavo Pinto,et al.  Data-Oriented Characterization of Application-Level Energy Optimization , 2015, FASE.

[39]  Simon L. Peyton Jones,et al.  Time and space profiling for non-strict, higher-order functional languages , 1995, POPL '95.

[40]  Klara Nahrstedt,et al.  Energy-efficient soft real-time CPU scheduling for mobile multimedia systems , 2003, SOSP '03.

[41]  Maurice Herlihy,et al.  The art of multiprocessor programming , 2020, PODC '06.

[42]  Sharad Malik,et al.  Power analysis of embedded software: a first step towards software power minimization , 1994, IEEE Trans. Very Large Scale Integr. Syst..

[43]  Abram Hindle Green mining: A methodology of relating software change to power consumption , 2012, 2012 9th IEEE Working Conference on Mining Software Repositories (MSR).

[44]  Ruzanna Chitchyan,et al.  Sustainability Design and Software: The Karlskrona Manifesto , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[45]  Anantha P. Chandrakasan,et al.  Low-power CMOS digital design , 1992 .