SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais de 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 Lines
GreenLabAtDI
 
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
GreenLabAtDI
 
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
GreenLabAtDI
 

Mais de 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
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
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-...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

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

Notas do Editor

  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