Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language
1. 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
17. 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.
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.
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.
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
Haskell está sendo utilizado tanto no contexto móvel quanto em servidores.
Estas operações são *abstractas* cujas implementações concretas se conseguem com funções nas interfaces
|base| = 100 000
|aux| = 1 000
We can duplicate the number of configurations, since we ran experiments in more than one machine. At least two!
Results of remove operation for Sequences
Capabilities: virtual processors that the Haskell runtime system uses to manage parallel execution.
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.
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
Reforçar a diversidade dos benchmarks
TWO MACHINES!
No special purpose for 999
switching from forkIO to forkON can yell big savings, and
switching from thread management constructs in Haskell is simple!
Observar linha verde: dos melhores desempenhos em tempo de execução, dos piores em termos de consumo de energia