Towards a Green Ranking for
Programming Languages
M. Couto, R. Pereira, F. Ribeiro, R. Rua, & J. Saraiva
Universidade do Minho & INESC Tec/HASLab
ruipereira@di.uminho.pt
greenlab.di.uminho.pt
Going Green
2
+ =
Global energy system is unsustainable
3
Green Computing
4
 Caught the attention of many companies allowing them to save:
“close to 50% of the energy costs of an organization can be attributed to
the IT departments”
- [PICMET, 2009]
“up to 90% of energy used by ICT hardware can be attributed to software”
- [The Greenhouse Gas Protocol Report, 2013]
Green Software
 Reducing energy consumption through software analysis and optimization
 Problem:
 How to analyze
 How to interpret
 How to improve
5
Green Software
 Problems (extended to programmers):
 How to analyze
 How to interpret
 How to improve
6
Mining questions about software energy consumption
- [MSR’14]
Integrated energy-directed test suite optimization
- [ISTA’14]
Seeds: A software engineer’s energy-optimization decision
support framework - [ICSE’14]
Energy vs. Power
7
 Power (w) – rate (or effort) at which that work is done
 Energy (J) – amount of work done
 Power can change constantly while Energy is the accumulation
Energy = Power x Seconds
Power
Energy
100W360,000 J = x 3,600s
Motivation
8
 Understanding the energy efficiency of programming languages
Is a faster language always a more energy efficient one?
Are there languages which run slower while consuming less energy?
Which are the most energy efficient languages?
Comparing Programming Languages
9
C Java OCaml Lua
= = =
* Formerly known as The Great Computer Language Shootout
The Computer Language Benchmarks Game (CLBG)
10
 Project to compare programming languages
 28 different programming languages
 13 different benchmarks
 Experts compete to code the fastest solution
 Same underlying algorithms
 Publicly available:
 Source Code
 Compiler Versions
 Optimization Flags
 Comparable and easily replicable programs/solutions!
Design
11
12
 Running Average Power Limit
 Designed by intel for i5/i7 architectures (SandyBridge, IvyBridge, Haswell, etc)
 Monitors energy consumption info for Machine-Specific Registers (MSRs)
 Allows very precise and fine-grain measurements through function calls
 DRAM/GPU
 CPU
 Package
What is RAPL?
Energy Measurements
13
Execution
 Linux Ubuntu 16.0 4.8.0-22-generic
 16GB Ram
 Intel(R) Core(TM) i5-4460 CPU @ 3.40GHz
 Compiler versions: https://sites.google.com/view/energy-efficiency-languages/setup
 Compile
 10 Languages x 10 Benchmarks = 100 Results
-> Run -> Measure
14
Results
15
Results
16
Results
17
Results
18
Results
19
Wrap Up
 Initial starting place for a ranking of programming languages
 Unexpected results
 Time and Energy are not always proportional
 C is still the King
20
Wrap Up
 Initial starting place for a ranking of programming languages
 Unexpected results
 Time and Energy are not always proportional
 C is still the King
Future Work
 Compare energy efficiency of the remaining 17 languages
 Measure DRAM consumption
 Understand DRAM consumption relation with memory usage
 Best language for energy, time, and memory?
21
Energy Efficiency Across Programming Languages – SLE’17
* https://sites.google.com/view/energy-efficiency-languages
Towards a Green Ranking for
Programming Languages
M. Couto, R. Pereira, F. Ribeiro, R. Rua, & J. Saraiva
Universidade do Minho & INESC Tec/HASLab
ruipereira@di.uminho.pt
greenlab.di.uminho.pt

Towards a Green Ranking for Programming Languages

  • 1.
    Towards a GreenRanking for Programming Languages M. Couto, R. Pereira, F. Ribeiro, R. Rua, & J. Saraiva Universidade do Minho & INESC Tec/HASLab ruipereira@di.uminho.pt greenlab.di.uminho.pt
  • 2.
  • 3.
    Global energy systemis unsustainable 3
  • 4.
    Green Computing 4  Caughtthe attention of many companies allowing them to save: “close to 50% of the energy costs of an organization can be attributed to the IT departments” - [PICMET, 2009] “up to 90% of energy used by ICT hardware can be attributed to software” - [The Greenhouse Gas Protocol Report, 2013]
  • 5.
    Green Software  Reducingenergy consumption through software analysis and optimization  Problem:  How to analyze  How to interpret  How to improve 5
  • 6.
    Green Software  Problems(extended to programmers):  How to analyze  How to interpret  How to improve 6 Mining questions about software energy consumption - [MSR’14] Integrated energy-directed test suite optimization - [ISTA’14] Seeds: A software engineer’s energy-optimization decision support framework - [ICSE’14]
  • 7.
    Energy vs. Power 7 Power (w) – rate (or effort) at which that work is done  Energy (J) – amount of work done  Power can change constantly while Energy is the accumulation Energy = Power x Seconds Power Energy 100W360,000 J = x 3,600s
  • 8.
    Motivation 8  Understanding theenergy efficiency of programming languages Is a faster language always a more energy efficient one? Are there languages which run slower while consuming less energy? Which are the most energy efficient languages?
  • 9.
    Comparing Programming Languages 9 CJava OCaml Lua = = = * Formerly known as The Great Computer Language Shootout
  • 10.
    The Computer LanguageBenchmarks Game (CLBG) 10  Project to compare programming languages  28 different programming languages  13 different benchmarks  Experts compete to code the fastest solution  Same underlying algorithms  Publicly available:  Source Code  Compiler Versions  Optimization Flags  Comparable and easily replicable programs/solutions!
  • 11.
  • 12.
    12  Running AveragePower Limit  Designed by intel for i5/i7 architectures (SandyBridge, IvyBridge, Haswell, etc)  Monitors energy consumption info for Machine-Specific Registers (MSRs)  Allows very precise and fine-grain measurements through function calls  DRAM/GPU  CPU  Package What is RAPL? Energy Measurements
  • 13.
    13 Execution  Linux Ubuntu16.0 4.8.0-22-generic  16GB Ram  Intel(R) Core(TM) i5-4460 CPU @ 3.40GHz  Compiler versions: https://sites.google.com/view/energy-efficiency-languages/setup  Compile  10 Languages x 10 Benchmarks = 100 Results -> Run -> Measure
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
    19 Wrap Up  Initialstarting place for a ranking of programming languages  Unexpected results  Time and Energy are not always proportional  C is still the King
  • 20.
    20 Wrap Up  Initialstarting place for a ranking of programming languages  Unexpected results  Time and Energy are not always proportional  C is still the King Future Work  Compare energy efficiency of the remaining 17 languages  Measure DRAM consumption  Understand DRAM consumption relation with memory usage  Best language for energy, time, and memory?
  • 21.
    21 Energy Efficiency AcrossProgramming Languages – SLE’17 * https://sites.google.com/view/energy-efficiency-languages
  • 22.
    Towards a GreenRanking for Programming Languages M. Couto, R. Pereira, F. Ribeiro, R. Rua, & J. Saraiva Universidade do Minho & INESC Tec/HASLab ruipereira@di.uminho.pt greenlab.di.uminho.pt

Editor's Notes

  • #3 Come to a better realization of what we have been doing to the environment
  • #6 Patterns, habits, structures algorithms
  • #7 Aware of the energy consumption problem, many times seeking help in resolving this, misconceptions within the programming community as to what causes highenergy consumption, how to solve them a heavy lack of support and knowledge for energy-aware development
  • #9 So for this we need to be able to first obtain comparable solutions
  • #10 In order to compare (both in terms of execution time and energy consumption) different languages, we need solutions/programs for the same problems expressed in each of those languages. Developing comparable programs written in different languages is both complex and time consuming.
  • #11 Ranging from hashtable updates, DNA sequence scans, binary tree traversals etc. Essentially the exact commands to run the programs as they were submitted to produce the most efficient solutions It isn’t novel to use CLBG, it has been used countless amount of times in other research for comparing languages (usually for performance)
  • #12 Threads Distribution of atleast atleast one paradigm and had 100% code submission coverage
  • #16 The faster is not always the most energy efficient. (Fortran)
  • #17 Lua and Jruby and Perl
  • #18 Java has higher energy consumption than Ocaml, yet it is faster Lua and Perl also show this example C# 4x more energy than C. 9x more to finish (Not always directly proportional ) Looking at the ratios, the previous comments are further strengthened. While in most cases faster is greener, the Energy equation also depends on Power, and as we can see this ratio is rarely constant and thus we can understand how this is not purely a performance issue
  • #19 The three interpreted languages Lua Jruby and Perl have a tendency to not only be the slowest but more energy consuming. Even so, Lua tends to be the slowest while consuming less. Roughly 12% slower than perl and 53% less energy Here we can also clearly see C dominates followed by Java. Ocaml Fortran and Lua are more energy efficient than performance efficient, and C# Go Jruby and Perl are the other way around