SlideShare a Scribd company logo
1 of 35
Haskell in Green Land: Analyzing the Energy
Behavior of a Purely Functional Language
Luís Gabriel Lima1, Gilberto Melfe2, Francisco Soares-Neto1,
Paulo Lieuthier1, João Paulo Fernandes2, and Fernando Castor1
1 {lgnfl, fmssn, pvjl, castor}@cin.ufpe.br
2 gilbertomelfe@gmail.com, jpf@di.ubi.pt
1
Global energy system is unsustainable
2
3
4
Haskell has feelings too!
5
rq
6
Can we save energy by refactoring Haskell
programs to use different data structure
implementations or concurrent
programming constructs?
Experimental Setup
2x10-core Intel Xeon E5-2660 v2
processors(Ivy Bridge) 256GB of DDR3 1600MHz RAM
Criterion
RAPL
7
Study 1: Purely functional data structures
8
RQ1. How do different implementations of
the same abstractions compare in terms of
run time and energy efficiency?
9
RQ2. For concrete operations, what is the
relationship between their performance
and energy consumption?
10
Study 1: Edison Library
Collections Associative Collections Sequences
EnumSet
StandardSet
UnbalancedSet
LazyPairingHeap
LeftistHeap
MinHeap
SkewHeap
SplayHeap
AssocList
PatriciaLoMap
StandardMap
TernaryTrie
BankersQueue
SimpleQueue
BinaryRandList
JoinList
RandList
BraunSeq
FingerSeq
ListSeq
RevSeq
SizedSeq
MyersStack
11
Study 1: Benchmark
iters operation base aux
1
1000
1
1000
5000
1
10000
10
5000
10
add
addAll
clear
contains
containsAll
iterator
remove
removeAll
toArray
retainAll
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
100000
1000
n.a.
1
1000
n.a.
1
1000
n.a.
1000
12
13
iters = 0;
while iters < 10
retainAll base aux;
iters++;
640 configurations
6000+ executions
14
Study 2: Results
15
http://green-haskell.github.io
Study 1: Results
16
Study 1: Findings
17
RQ1. How do different implementations of the same abstractions
compare in terms of runtime and energy efficiency?
RQ2. For concrete operations, what is the relationship between their
performance and their energy consumption?
Energy is proportional to execution time.
Full details on green-haskell.github.io.
Study 2: Concurrent programming constructs
18
19
RQ1. Do alternative thread management
constructs have different impacts on energy
consumption?
20
RQ2. Do alternative data-sharing primitives
have different impacts on energy
consumption?
Study 2: Concurrency Primitives
Thread management: forkIO, forkOn,
forkOS
22
Study 2: Concurrency Primitives
Data sharing: MVar, TVar, TMVar
23
9 benchmarks: IO, memory, synchronization bound
Up to 9 variants per benchmark
9 configurations for # of processors
24
Study 2: Results
25
http://green-haskell.github.io
26
Small changes can produce big savings
Faster is not always greener
27
28
There is no overall winner
29
Made two tools energy-aware:
Haskell profiler
Criterion
31
fsklsdfnjdsfjsadfhjksdhflkjsdhflkjsah
32
fsklsdfnjdsfjsadfhjksdhflkjsdhflkjsah
33
Population: 56483 (2013)
Haskell programmers: 0 (est.)
34
http://green-haskell.github.io
35
http://green-haskell.github.io
36
http://green-haskell.github.io
37
http://green-haskell.github.io

More Related Content

More from GreenLabAtDI

Products go Green: Worst-Case Energy Consumption in Software Product Lines
Products go Green: Worst-Case Energy Consumption in Software Product LinesProducts go Green: Worst-Case Energy Consumption in Software Product Lines
Products go Green: Worst-Case Energy Consumption in Software Product LinesGreenLabAtDI
 
Towards a Green Ranking for Programming Languages
Towards a Green Ranking for Programming LanguagesTowards a Green Ranking for Programming Languages
Towards a Green Ranking for Programming LanguagesGreenLabAtDI
 
Static Energy Prediction in Software: A Worst-Case Scenario Approach
Static Energy Prediction in Software: A Worst-Case Scenario ApproachStatic Energy Prediction in Software: A Worst-Case Scenario Approach
Static Energy Prediction in Software: A Worst-Case Scenario ApproachGreenLabAtDI
 
Locating Energy Hotspots in Source Code
Locating Energy Hotspots in Source CodeLocating Energy Hotspots in Source Code
Locating Energy Hotspots in Source CodeGreenLabAtDI
 
Green Computing as an Engineering Discipline
Green Computing as an Engineering DisciplineGreen Computing as an Engineering Discipline
Green Computing as an Engineering DisciplineGreenLabAtDI
 
The Influence of the Java Collection Framework on Overall Energy Consumption
The Influence of the Java Collection Framework on Overall Energy ConsumptionThe Influence of the Java Collection Framework on Overall Energy Consumption
The Influence of the Java Collection Framework on Overall Energy ConsumptionGreenLabAtDI
 
Green Software Lab
Green Software LabGreen Software Lab
Green Software LabGreenLabAtDI
 
GreenDroid: A Tool for Analysing Power Consumption in the Android Ecosystem
GreenDroid: A Tool for Analysing Power Consumption in the Android EcosystemGreenDroid: A Tool for Analysing Power Consumption in the Android Ecosystem
GreenDroid: A Tool for Analysing Power Consumption in the Android EcosystemGreenLabAtDI
 
Marco Couto's Msc Thesis Presentation
Marco Couto's Msc Thesis PresentationMarco Couto's Msc Thesis Presentation
Marco Couto's Msc Thesis PresentationGreenLabAtDI
 
Rui Pereira's PhD Pre-Thesis
Rui Pereira's PhD Pre-ThesisRui Pereira's PhD Pre-Thesis
Rui Pereira's PhD Pre-ThesisGreenLabAtDI
 
Detecting Anomalous Energy Consumption in Android Applications
Detecting Anomalous Energy Consumption in Android ApplicationsDetecting Anomalous Energy Consumption in Android Applications
Detecting Anomalous Energy Consumption in Android ApplicationsGreenLabAtDI
 
PresentationMeasuring and Visualizing Energy Consumption within Software Code
PresentationMeasuring and Visualizing Energy Consumption within Software CodePresentationMeasuring and Visualizing Energy Consumption within Software Code
PresentationMeasuring and Visualizing Energy Consumption within Software CodeGreenLabAtDI
 

More from GreenLabAtDI (12)

Products go Green: Worst-Case Energy Consumption in Software Product Lines
Products go Green: Worst-Case Energy Consumption in Software Product LinesProducts go Green: Worst-Case Energy Consumption in Software Product Lines
Products go Green: Worst-Case Energy Consumption in Software Product Lines
 
Towards a Green Ranking for Programming Languages
Towards a Green Ranking for Programming LanguagesTowards a Green Ranking for Programming Languages
Towards a Green Ranking for Programming Languages
 
Static Energy Prediction in Software: A Worst-Case Scenario Approach
Static Energy Prediction in Software: A Worst-Case Scenario ApproachStatic Energy Prediction in Software: A Worst-Case Scenario Approach
Static Energy Prediction in Software: A Worst-Case Scenario Approach
 
Locating Energy Hotspots in Source Code
Locating Energy Hotspots in Source CodeLocating Energy Hotspots in Source Code
Locating Energy Hotspots in Source Code
 
Green Computing as an Engineering Discipline
Green Computing as an Engineering DisciplineGreen Computing as an Engineering Discipline
Green Computing as an Engineering Discipline
 
The Influence of the Java Collection Framework on Overall Energy Consumption
The Influence of the Java Collection Framework on Overall Energy ConsumptionThe Influence of the Java Collection Framework on Overall Energy Consumption
The Influence of the Java Collection Framework on Overall Energy Consumption
 
Green Software Lab
Green Software LabGreen Software Lab
Green Software Lab
 
GreenDroid: A Tool for Analysing Power Consumption in the Android Ecosystem
GreenDroid: A Tool for Analysing Power Consumption in the Android EcosystemGreenDroid: A Tool for Analysing Power Consumption in the Android Ecosystem
GreenDroid: A Tool for Analysing Power Consumption in the Android Ecosystem
 
Marco Couto's Msc Thesis Presentation
Marco Couto's Msc Thesis PresentationMarco Couto's Msc Thesis Presentation
Marco Couto's Msc Thesis Presentation
 
Rui Pereira's PhD Pre-Thesis
Rui Pereira's PhD Pre-ThesisRui Pereira's PhD Pre-Thesis
Rui Pereira's PhD Pre-Thesis
 
Detecting Anomalous Energy Consumption in Android Applications
Detecting Anomalous Energy Consumption in Android ApplicationsDetecting Anomalous Energy Consumption in Android Applications
Detecting Anomalous Energy Consumption in Android Applications
 
PresentationMeasuring and Visualizing Energy Consumption within Software Code
PresentationMeasuring and Visualizing Energy Consumption within Software CodePresentationMeasuring and Visualizing Energy Consumption within Software Code
PresentationMeasuring and Visualizing Energy Consumption within Software Code
 

Recently uploaded

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language

Editor's Notes

  1. Dispositivos móveis estão cada vez mais presentes baterias desses dispositivos durem o máximo possível Servidores são o coração da internet Devido a grande escala, pequenas diferenças em consumo de energia podem resultar em muita economia de dinheiro Gastar menos energia é tão importante que muitas empresas estão movendo seus data centers para regiões frias com intenção reduzir o consumo de energia com refrigeração.
  2. A large body of work in hardware/architecture, OS, runtime systems Thesedays, there’s a growing concern with tools/methods to analyse/improve energy consumption at the application level Developers are interested in saving energy 1 Pinto et al. “Mining Questions About Software Energy Consumption”. MSR'14.
  3. Functional programming (FP) is on the rise Mainstream languages are incorporating FP features Haskell influences a lot of functional PLs Lack of studies on energy efficiency
  4. Haskell está sendo utilizado tanto no contexto móvel quanto em servidores.
  5. Estas operações são *abstractas* cujas implementações concretas se conseguem com funções nas interfaces
  6. |base| = 100 000 |aux| = 1 000
  7. We can duplicate the number of configurations, since we ran experiments in more than one machine. At least two!
  8. Results of remove operation for Sequences
  9. Capabilities: virtual processors that the Haskell runtime system uses to manage parallel execution.
  10. forkIO - creates a new thread that is managed by the language’s scheduler forkOn - creates a new thread to be executed on a specific processor forkOS — creates a thread that is bound to a specific operating system thread. This is important for foreign functions that make use of thread-local state.
  11. MVar - em Haskell, é a primitiva básica para partilha de informação Pode ser entendida como uma caixa que ou está vazia ou está cheia. takeMVar/putMVar bloqueiam caso a caixa não esteja no estado esperado TVar é disponibilizada por uma implementação de software transactional memory TMVar é uma variante transacional do tipo MVar
  12. Reforçar a diversidade dos benchmarks TWO MACHINES! No special purpose for 999
  13. switching from forkIO to forkON can yell big savings, and switching from thread management constructs in Haskell is simple!
  14. Observar linha verde: dos melhores desempenhos em tempo de execução, dos piores em termos de consumo de energia
  15. forkOS often bad MVars often good
  16. The End