Compiling Haskell for Energy Efficiency: Empirical Analysis of Individual Transformations

Maja Hanne Kirkeby, Bernardo Santos, João Paulo Fernandes, Alberto Pardo

Research output: Chapter in Book/Report/Conference proceedingArticle in proceedingsResearchpeer-review

Abstract

Energy efficiency is a growing concern for software developers. This empirical study investigates the impact of compiler optimizations on energy efficiency in Haskell programs compiled using the Glasgow Haskell Compiler (GHC). We focus on GHC's -O2 optimization series and explore the effects of selectively disabling individual optimizations using -fno-∗flags, alongside variations in initial execution temperatures.We examined 25 GHC optimizations across 18 benchmarks from the NoFib Haskell Benchmark Suite resulting in 468 combinations of benchmark and optimization-deactivations. Data was collected at three starting temperatures (45°C, 55°C, and 65°C), resulting in 40 samples per benchmark-optimization combination. Our key metrics included energy consumption and execution time.Considering all combinations, for 24% of the individual optimizations provided, when disabled, a significant increase in energy consumption, i.e., enabling these optimizations resulted in more energy-efficient executables, whereas for 26% the optimization provided a significant increase in time, when disabled. However, only for 12% of all the combinations, the disabling increased both time and energy consumption significantly, and in 5% of all the combinations, we observed opposite impacts on time and energy.We found that 10 optimizations produced equally or more energy-efficient executables for all the benchmarks, whereas only one compiler optimization produced a better or equally performing executable for all the benchmarks.As a secondary finding, we explored the influence of initial temperatures on energy consumption. While programs that started at 45°C showed the least variance in terms of both energy consumption and wall time, those started at 55°C tended to exhibit lower energy consumption for the typical program compared to those started at 45°C or 65°C.
Original languageEnglish
Title of host publication39th Annual ACM Symposium on Applied Computing, SAC 2024
Number of pages10
PublisherAssociation for Computing Machinery
Publication date8 Apr 2024
Pages1104-1113
ISBN (Electronic)9798400702433
DOIs
Publication statusPublished - 8 Apr 2024
Event39th Annual ACM Symposium on Applied Computing, SAC 2024 - Avila, Spain
Duration: 8 Apr 202412 Apr 2024

Conference

Conference39th Annual ACM Symposium on Applied Computing, SAC 2024
Country/TerritorySpain
CityAvila
Period08/04/202412/04/2024
SponsorACM Special Interested Group on Applied Computing (SIGAPP)
SeriesProceedings of the ACM Symposium on Applied Computing

Keywords

  • compiler optimizations
  • energy consumption
  • functional programming
  • program transformations
  • programming languages

Cite this