How Green are Java Best Practices?
Best Coding Practices and Software Eco-Design
Jérôme Rocheteau
Institut Catholique d’Arts et Métiers, Nantes, France
GreenDays@Rennes – Mardi 1er juillet 2014
How Green are Java Best Practices? GreenDays | 2014-07-01 1 / 33
Overview
1 Eco-Design and Best Practices
2 Formalizing Practices
3 Measuring Codes
4 Analyzing Measures, Codes, Practices
5 Eco-Design Indicators
How Green are Java Best Practices? GreenDays | 2014-07-01 2 / 33
Eco-Design and Best Practices
1 Eco-Design and Best Practices
Context and Issues
Hypothesis and Objectives
2 Formalizing Practices
3 Measuring Codes
4 Analyzing Measures, Codes, Practices
5 Eco-Design Indicators
How Green are Java Best Practices? GreenDays | 2014-07-01 3 / 33
Context and Issues
Context:
ICT accounted 2% of carbon emissions in 2007
Energy efficiency relies on hardware but not software
Works on energy efficiency classes, energy-aware systems
Issues:
Help developers to build energy-efficient software
1 Detect energy-consuming patterns in source code
2 Replace these patterns by energy-saving ones
Qualify the energy impact for such best practices
How Green are Java Best Practices? GreenDays | 2014-07-01 4 / 33
Hypothesis and Objectives
Hypothesis
Best coding practices are eco-design rules
Objectives:
1 Formalizing Java best practices
2 Measuring savings of memory and energy at runtime
3 Evaluating confidence of such results
How Green are Java Best Practices? GreenDays | 2014-07-01 5 / 33
Formalizing Practices
1 Eco-Design and Best Practices
2 Formalizing Practices
Informal and Formal Examples
Time, Space, Energy Semantics
3 Measuring Codes
4 Analyzing Measures, Codes, Practices
5 Eco-Design Indicators
How Green are Java Best Practices? GreenDays | 2014-07-01 6 / 33
Informal and Formal Examples
Best Coding Practice Example / Informal Rule:
String Literal Initialization
Initialization of strings with the keyword ’new’ creates new
objects. This is costly in time and memory space. Initializations
with literal strings avoids this.
How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
Informal and Formal Examples
Best Coding Practice Example / Informal Rule:
String Literal Initialization
Initialization of strings with the keyword ’new’ creates new
objects. This is costly in time and memory space. Initializations
with literal strings avoids this.
Three shape of Java best coding practices :
1 Prefer this
2 Avoid that
3 Replace that by this
How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
Informal and Formal Examples
Best Coding Practice Example / Informal Rule:
String Literal Initialization
Initialization of strings with the keyword ’new’ creates new
objects. This is costly in time and memory space. Initializations
with literal strings avoids this.
Three shape of Java best coding practices :
1 Prefer this
2 Avoid that
3 Replace that by this
Can be extended to other primitive/wrapper types
How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
Informal and Formal Examples
Best Coding Practice Example / Informal Rule:
String Literal Initialization
Initialization of strings with the keyword ’new’ creates new
objects. This is costly in time and memory space. Initializations
with literal strings avoids this.
Three shape of Java best coding practices :
1 Prefer this
2 Avoid that
3 Replace that by this
Can be extended to other primitive/wrapper types
Can be applied to other programming languages
How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
Informal and Formal Examples
Best Coding Practice Example / Informal Rule:
String Literal Initialization
Initialization of strings with the keyword ’new’ creates new
objects. This is costly in time and memory space. Initializations
with literal strings avoids this.
Three shape of Java best coding practices :
1 Prefer this
2 Avoid that
3 Replace that by this
Can be extended to other primitive/wrapper types
Can be applied to other programming languages
How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
Informal and Formal Examples
Listing 1: Prefer String Literal Initialization
<rule id="prefer-string-literal-initialization">
<title>Prefer string literal initialization</title>
<description>
Primitive type objects should be initialized with primitive values
and without the use of any constructors.
</description>
<check green="StringValue" gray="StringObject" />
</rule>
How Green are Java Best Practices? GreenDays | 2014-07-01 8 / 33
Informal and Formal Examples
Listing 2: String Literal Initialization
p u b l i c c l a s s S t r i n g V a l u e implements Code {
p r i v a t e S t r i n g [ ] a r r a y ;
p u b l i c void setUp () {
a r r a y = new S t r i n g [ 1 0 0 0 ] ;
}
p u b l i c void doRun () throws Exception {
f o r ( i n t i = 0; i < 1000; i ++) {
a r r a y [ i ] = " abcdefg . . . " ;
}
}
p u b l i c void tearDown () {
a r r a y = n u l l ;
}
}
How Green are Java Best Practices? GreenDays | 2014-07-01 9 / 33
Informal and Formal Examples
Listing 3: String Object Initialization
p u b l i c c l a s s S t r i n g O b j e c t implements Code {
p r i v a t e S t r i n g [ ] a r r a y ;
p u b l i c void setUp () {
a r r a y = new S t r i n g [ 1 0 0 0 ] ;
}
p u b l i c void doRun () throws Exception {
f o r ( i n t i = 0; i < 1000; i ++) {
a r r a y [ i ] = new S t r i n g ( " abcdefg . . . " ) ;
}
}
p u b l i c void tearDown () {
a r r a y = n u l l ;
}
}
How Green are Java Best Practices? GreenDays | 2014-07-01 10 / 33
Time, Space, Energy Semantics
Prefer Literal
Initialization
time = ft (td , tc )
space = fs (sd , sc )
energy = fe(ed , ec )
How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
Time, Space, Energy Semantics
String Value
Initialization
Prefer Literal
Initialization
String Object
Initialization
time = ft (td , tc )
space = fs (sd , sc )
energy = fe(ed , ec )
How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
Time, Space, Energy Semantics
String Value
Initialization
Prefer Literal
Initialization
String Object
Initialization
time tc
space sc
energy ec
time td
space sd
energy ed
time = ft (td , tc )
space = fs (sd , sc )
energy = fe(ed , ec )
How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
Time, Space, Energy Semantics
String Value
Initialization
Prefer Literal
Initialization
String Object
Initialization
time tc
space sc
energy ec
time td
space sd
energy ed
time = ft (td , tc )
space = fs (sd , sc )
energy = fe(ed , ec )
How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
Time, Space, Energy Semantics
Goal: statistical static analysis method and tools
original code
How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
Time, Space, Energy Semantics
Goal: statistical static analysis method and tools
original code
How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
Time, Space, Energy Semantics
Goal: statistical static analysis method and tools
original code refactored code
How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
Time, Space, Energy Semantics
Goal: statistical static analysis method and tools
original code refactored code
possible savings
X joules / X %
How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
Measuring Codes
1 Eco-Design and Best Practices
2 Formalizing Practices
3 Measuring Codes
Needs and Requirements
Measure Task and Process
4 Analyzing Measures, Codes, Practices
5 Eco-Design Indicators
How Green are Java Best Practices? GreenDays | 2014-07-01 13 / 33
Needs and Requirements
Needs:
Requirements:
How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
Needs and Requirements
Needs:
power-meter with digital outputs
Requirements:
power-meter with fine-grain precision
How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
Needs and Requirements
Needs:
power-meter with digital outputs
memory monitor with digital outputs
Requirements:
power-meter with fine-grain precision
How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
Needs and Requirements
Needs:
power-meter with digital outputs
memory monitor with digital outputs
platform for running Java codes
Requirements:
power-meter with fine-grain precision
Java micro-benchmarking to avoid JIT
How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
Needs and Requirements
Needs:
power-meter with digital outputs
memory monitor with digital outputs
platform for running Java codes
system for managing codes and measures
Requirements:
power-meter with fine-grain precision
Java micro-benchmarking to avoid JIT
system able to manage physical and logical sensors
How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
Measure Task and Process
Measurement Protocol:
1 4 seconds idle
2 10 seconds execution time
3 3 seconds idle
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Semantics based on quantitative metrics:
x-axis execution time
y-axis instant power or instant memory space
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Preliminary Computations:
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Preliminary Computations:
total energy obtained by the trapezoidal rule
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Preliminary Computations:
total energy obtained by the trapezoidal rule
idle power = average of the first 4 second instant powers
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Preliminary Computations:
total energy obtained by the trapezoidal rule
idle power = average of the first 4 second instant powers
idle energy = idle power × protocol time
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Code energy computation and normalization:
code energy = total energy - idle energy
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Code energy computation and normalization:
code energy = total energy - idle energy
normalized code energy = code energy / times of execution
How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
Measure Task and Process
Measure Process:
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Measure Task and Process
Measure Process:
1 Retrieve an available Java code
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Measure Task and Process
Measure Process:
1 Retrieve an available Java code
2 Iterate while this code isn’t mature:
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Measure Task and Process
Measure Process:
1 Retrieve an available Java code
2 Iterate while this code isn’t mature:
Clean its measure set
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Measure Task and Process
Measure Process:
1 Retrieve an available Java code
2 Iterate while this code isn’t mature:
Clean its measure set
Compute its maturity
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Measure Task and Process
Measure Process:
1 Retrieve an available Java code
2 Iterate while this code isn’t mature:
Clean its measure set
Compute its maturity
Plan new measures if required
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Measure Task and Process
Measure Process:
1 Retrieve an available Java code
2 Iterate while this code isn’t mature:
Clean its measure set
Compute its maturity
Plan new measures if required
Perform these measures
3 Send the report of this code
How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
Analyzing Measures, Codes, Practices
1 Eco-Design and Best Practices
2 Formalizing Practices
3 Measuring Codes
4 Analyzing Measures, Codes, Practices
Clean and Canonical Measures
Code Maturity
Results
5 Eco-Design Indicators
How Green are Java Best Practices? GreenDays | 2014-07-01 17 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
disturbances before the measure task underestimate
How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
disturbances before the measure task underestimate
disturbances after the measure task overestimate
How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
disturbances before the measure task underestimate
disturbances after the measure task overestimate
disturbances during the measure task overestimate
How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
disturbances before the measure task
disturbances after the measure task
disturbances during the measure task
2 mere algorithms for cleaning measures:
How Green are Java Best Practices? GreenDays | 2014-07-01 19 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
disturbances before the measure task
disturbances after the measure task
disturbances during the measure task
2 mere algorithms for cleaning measures:
bounds checking algorithm (over a single measure)
How Green are Java Best Practices? GreenDays | 2014-07-01 19 / 33
Clean and Canonical Measures
3 kinds of measure disturbances:
disturbances before the measure task
disturbances after the measure task
disturbances during the measure task
2 mere algorithms for cleaning measures:
bounds checking algorithm (over a single measure)
split-and-merge algorithm (over a set of measures)
How Green are Java Best Practices? GreenDays | 2014-07-01 19 / 33
Clean and Canonical Measures
Cleaning algorithm evaluation:
500 clean measures from 25 rules annotated by 3 experts
How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
Clean and Canonical Measures
Cleaning algorithm evaluation:
500 clean measures from 25 rules annotated by 3 experts
inter-agreement κ: 0.94 (almost perfect)
How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
Clean and Canonical Measures
Cleaning algorithm evaluation:
500 clean measures from 25 rules annotated by 3 experts
inter-agreement κ: 0.94 (almost perfect)
baseline = quartile method
precision: 0.953
recall: 0.911
How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
Clean and Canonical Measures
Cleaning algorithm evaluation:
500 clean measures from 25 rules annotated by 3 experts
inter-agreement κ: 0.94 (almost perfect)
baseline = quartile method
precision: 0.953
recall: 0.911
split-and-merge algorithm
precision: 0.941
recall: 1.0
How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
Clean and Canonical Measures
Cleaning algorithm evaluation:
500 clean measures from 25 rules annotated by 3 experts
inter-agreement κ: 0.94 (almost perfect)
baseline = quartile method
precision: 0.953
recall: 0.911
split-and-merge algorithm
precision: 0.941
recall: 1.0
remove all disturbed measures
How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
Clean and Canonical Measures
Canonical measure:
How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
Clean and Canonical Measures
Canonical measure:
time: t3
space: s3
energy: e3
time: t2
space: s2
energy: e2
time: t1
space: s1
energy: e1
How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
Clean and Canonical Measures
Canonical measure:
time: t3
space: s3
energy: e3
time: t2
space: s2
energy: e2
time: t1
space: s1
energy: e1
time: t
space: s
energy: e
How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
Clean and Canonical Measures
Canonical measure:
time: t3
space: s3
energy: e3
time: t2
space: s2
energy: e2
time: t1
space: s1
energy: e1
time: t
space: s
energy: e
How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
Clean and Canonical Measures
Canonical measure:
time: t3
space: s3
energy: e3
time: t2
space: s2
energy: e2
time: t1
space: s1
energy: e1
time: t
space: s
energy: e
How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
Clean and Canonical Measures
Canonical measure:
time: t3
space: s3
energy: e3
time: t2
space: s2
energy: e2
time: t1
space: s1
energy: e1
time: t
space: s
energy: e
error margin: 2%
How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
Code Maturity
Code Maturity
How many clean measures required for reliable results?
How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
Code Maturity
Code Maturity
How many clean measures required for reliable results?
0 20 40 60 80 100 120
5
10
15
Measure Number
RelativeStandardDeviation
How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
Code Maturity
Code Maturity
How many clean measures required for reliable results?
0 20 40 60 80 100 120
5
10
15
Measure Number
RelativeStandardDeviation
a set of 25 measures minimum
How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
Code Maturity
Code Maturity
How many clean measures required for reliable results?
0 20 40 60 80 100 120
5
10
15
Measure Number
RelativeStandardDeviation
a set of 25 measures minimum
a standard deviation less than 10%
How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
Results
Energy in nanojoules, time in nanoseconds
Memory in kilobytes
Standard Deviation on Energy
Replace Object Initialization by Literal Initialization
Rule Id
GreenEnergy
GrayEnergy
GreenTime
GrayTime
GreenMemory
GrayMemory
GreenStdDev
GrayStdDev
String 697 7885 842 7827 4136 36104 4.40% 8.14%
Float 10311 10448 4736 4127 20032 20032 5.85% 6.58%
Integer 685 9575 833 4591 4048 20032 5.21% 6.51%
Boolean 683 6267 775 4741 4048 20032 4.77% 7.03%
Char 695 33067 840 4595 4048 20032 5.04% 4.65%
Double 10003 10210 5810 4270 28032 28032 5.58% 7.83%
Long 669 8236 807 6066 4056 28032 2.89% 5.32%
Short 680 7819 819 3846 4048 20031 4.87% 7.71%
How Green are Java Best Practices? GreenDays | 2014-07-01 23 / 33
Results
Replace Object Initialization by Literal Initialization
Rule Id G
reen
Energy
G
ray
Energy
A
bsolute
G
ain
Relative
G
ain
String 697 7885 7188 91.16%
Float 10311 10448 137 1.31%
Integer 685 9575 8890 92.54%
Boolean 683 6267 5584 89.10%
Char 695 33067 32372 97.89%
Double 10003 10210 207 2.02%
Long 669 8236 7567 91.87%
Short 680 7819 7139 91.30%
How Green are Java Best Practices? GreenDays | 2014-07-01 24 / 33
Results
Rules for loops
A Prefer integer loop counters
B Avoid method loop conditions
C Prefer comparison-to-0 conditions
D Prefer first common condition
Id
GreenEnergy
GrayEnergy
GreenTime
GrayTime
GreenMemory
GrayMemory
GreenStdDev
GrayStdDev
A 82 98 4744 5931 16 16 8.66% 7.46%
B 8376 8602 6181 6364 20056 20056 3.83% 6.14%
C 89 284 4709 17367 16 16 5.09% 5.78%
D 97 100 4934 5017 16 16 4.37% 4.60%
How Green are Java Best Practices? GreenDays | 2014-07-01 25 / 33
Results
Rules for loops
A Prefer integer loop counters
B Avoid method loop conditions
C Prefer comparison-to-0 conditions
D Prefer first common condition
Id
G
reen
Energy
G
ray
Energy
A
bsolute
G
ain
Relative
G
ain
A 82 98 16 16.32%
B 8376 8602 226 2.62%
C 89 284 195 68.66%
D 97 100 3 3.00%
How Green are Java Best Practices? GreenDays | 2014-07-01 25 / 33
Results
Set String Builder or Buffer Size
A String Buffer/Builder capacity initialization
B String Buffer/Builder capacity setting
C String Buffer/Builder length setting
Id
GreenEnergy
GrayEnergy
GreenTime
GrayTime
GreenMemory
GrayMemory
GreenStdDev
GrayStdDev
A 593 1053 38085 59111 52056 73784 7.11% 8.40%
B 598 1053 38495 59111 52056 73784 7.86% 8.40%
C 1211 1053 59111 70765 73784 104064 8.40% 9.40%
A’ 378 899 19278 41088 52056 73784 8.27% 7.18%
B’ 429 899 41088 51214 73784 104064 7.18% 5.84%
C’ 1043 899 20976 41088 52056 73784 6.01% 7.18%
How Green are Java Best Practices? GreenDays | 2014-07-01 26 / 33
Results
Set String Builder or Buffer Size
A String Buffer/Builder capacity initialization
B String Buffer/Builder capacity setting
C String Buffer/Builder length setting
Id
G
reen
Energy
G
ray
Energy
A
bsolute
G
ain
Relative
G
ain
A 593 1053 460 43.68%
B 598 1053 455 43.20%
C 1211 1053 -158 -15.00%
A’ 378 899 521 57.95%
B’ 429 899 470 52.28%
C’ 1043 899 -144 -16.01%
How Green are Java Best Practices? GreenDays | 2014-07-01 26 / 33
Eco-Design Indicators
1 Eco-Design and Best Practices
2 Formalizing Practices
3 Measuring Codes
4 Analyzing Measures, Codes, Practices
5 Eco-Design Indicators
Summary
Future
How Green are Java Best Practices? GreenDays | 2014-07-01 27 / 33
Eco-Design Indicators
How Green are Java Best Practices? GreenDays | 2014-07-01 28 / 33
Eco-Design Indicators
Hypothesis
Best Coding Practices ≈ Eco-Design Rules
174 formalized and measured rules
How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
Eco-Design Indicators
Hypothesis
Best Coding Practices ≈ Eco-Design Rules
174 formalized and measured rules
55% rules huge savings (more than 10%)
How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
Eco-Design Indicators
Hypothesis
Best Coding Practices ≈ Eco-Design Rules
174 formalized and measured rules
55% rules huge savings (more than 10%)
20% rules few savings (between 3% and 10%)
How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
Eco-Design Indicators
Hypothesis
Best Coding Practices ≈ Eco-Design Rules
174 formalized and measured rules
55% rules huge savings (more than 10%)
20% rules few savings (between 3% and 10%)
15% rules no savings (between -3% and 3%)
How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
Eco-Design Indicators
Hypothesis
Best Coding Practices ≈ Eco-Design Rules
174 formalized and measured rules
55% rules huge savings (more than 10%)
20% rules few savings (between 3% and 10%)
15% rules no savings (between -3% and 3%)
10% rules some losses (less than -3%)
How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
hybrid physical and logical sensor management
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
hybrid physical and logical sensor management
complex client/server architecture
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
hybrid physical and logical sensor management
complex client/server architecture
focused star schema database
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
hybrid physical and logical sensor management
complex client/server architecture
focused star schema database
robust automatic iterative process
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
hybrid physical and logical sensor management
complex client/server architecture
focused star schema database
robust automatic iterative process
extensible programming API
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
With The Way: 1 reliable measure system
hybrid physical and logical sensor management
complex client/server architecture
focused star schema database
robust automatic iterative process
extensible programming API
reliable stable measure sets with few measures
How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
Eco-Design Indicators
• Jérôme Rocheteau, Virginie Gaillard, et Lamya Belhaj.
How Green are Java Best Coding Practices?
Proceedings of the 3rd International Conference on Smart
Grids and Green IT Systems,
pages 235–246.
Barcelona, Espagne, Avril 2014.
How Green are Java Best Practices? GreenDays | 2014-07-01 31 / 33
Future
1 Energy Efficiency Classes?
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
Relative savings
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
Relative savings
3 Rule indicators in different environments
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
Relative savings
3 Rule indicators in different environments
4 Rule indicators in different programming languages
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
Relative savings
3 Rule indicators in different environments
4 Rule indicators in different programming languages
5 Energy efficiency of different programming languages
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
Relative savings
3 Rule indicators in different environments
4 Rule indicators in different programming languages
5 Energy efficiency of different programming languages
6 Accuracy of different physical and/or logical sensors
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Future
1 Energy Efficiency Classes?
2 Eco-Design Indicators?
Absolute savings
Relative savings
3 Rule indicators in different environments
4 Rule indicators in different programming languages
5 Energy efficiency of different programming languages
6 Accuracy of different physical and/or logical sensors
7 Energy and memory footprints of logical sensors
How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
Thank you
How Green are Java Best Practices? GreenDays | 2014-07-01 33 / 33
Data Model
How Green are Java Best Practices? GreenDays | 2014-07-01 33 / 33

How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01

  • 1.
    How Green areJava Best Practices? Best Coding Practices and Software Eco-Design Jérôme Rocheteau Institut Catholique d’Arts et Métiers, Nantes, France GreenDays@Rennes – Mardi 1er juillet 2014 How Green are Java Best Practices? GreenDays | 2014-07-01 1 / 33
  • 2.
    Overview 1 Eco-Design andBest Practices 2 Formalizing Practices 3 Measuring Codes 4 Analyzing Measures, Codes, Practices 5 Eco-Design Indicators How Green are Java Best Practices? GreenDays | 2014-07-01 2 / 33
  • 3.
    Eco-Design and BestPractices 1 Eco-Design and Best Practices Context and Issues Hypothesis and Objectives 2 Formalizing Practices 3 Measuring Codes 4 Analyzing Measures, Codes, Practices 5 Eco-Design Indicators How Green are Java Best Practices? GreenDays | 2014-07-01 3 / 33
  • 4.
    Context and Issues Context: ICTaccounted 2% of carbon emissions in 2007 Energy efficiency relies on hardware but not software Works on energy efficiency classes, energy-aware systems Issues: Help developers to build energy-efficient software 1 Detect energy-consuming patterns in source code 2 Replace these patterns by energy-saving ones Qualify the energy impact for such best practices How Green are Java Best Practices? GreenDays | 2014-07-01 4 / 33
  • 5.
    Hypothesis and Objectives Hypothesis Bestcoding practices are eco-design rules Objectives: 1 Formalizing Java best practices 2 Measuring savings of memory and energy at runtime 3 Evaluating confidence of such results How Green are Java Best Practices? GreenDays | 2014-07-01 5 / 33
  • 6.
    Formalizing Practices 1 Eco-Designand Best Practices 2 Formalizing Practices Informal and Formal Examples Time, Space, Energy Semantics 3 Measuring Codes 4 Analyzing Measures, Codes, Practices 5 Eco-Design Indicators How Green are Java Best Practices? GreenDays | 2014-07-01 6 / 33
  • 7.
    Informal and FormalExamples Best Coding Practice Example / Informal Rule: String Literal Initialization Initialization of strings with the keyword ’new’ creates new objects. This is costly in time and memory space. Initializations with literal strings avoids this. How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
  • 8.
    Informal and FormalExamples Best Coding Practice Example / Informal Rule: String Literal Initialization Initialization of strings with the keyword ’new’ creates new objects. This is costly in time and memory space. Initializations with literal strings avoids this. Three shape of Java best coding practices : 1 Prefer this 2 Avoid that 3 Replace that by this How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
  • 9.
    Informal and FormalExamples Best Coding Practice Example / Informal Rule: String Literal Initialization Initialization of strings with the keyword ’new’ creates new objects. This is costly in time and memory space. Initializations with literal strings avoids this. Three shape of Java best coding practices : 1 Prefer this 2 Avoid that 3 Replace that by this Can be extended to other primitive/wrapper types How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
  • 10.
    Informal and FormalExamples Best Coding Practice Example / Informal Rule: String Literal Initialization Initialization of strings with the keyword ’new’ creates new objects. This is costly in time and memory space. Initializations with literal strings avoids this. Three shape of Java best coding practices : 1 Prefer this 2 Avoid that 3 Replace that by this Can be extended to other primitive/wrapper types Can be applied to other programming languages How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
  • 11.
    Informal and FormalExamples Best Coding Practice Example / Informal Rule: String Literal Initialization Initialization of strings with the keyword ’new’ creates new objects. This is costly in time and memory space. Initializations with literal strings avoids this. Three shape of Java best coding practices : 1 Prefer this 2 Avoid that 3 Replace that by this Can be extended to other primitive/wrapper types Can be applied to other programming languages How Green are Java Best Practices? GreenDays | 2014-07-01 7 / 33
  • 12.
    Informal and FormalExamples Listing 1: Prefer String Literal Initialization <rule id="prefer-string-literal-initialization"> <title>Prefer string literal initialization</title> <description> Primitive type objects should be initialized with primitive values and without the use of any constructors. </description> <check green="StringValue" gray="StringObject" /> </rule> How Green are Java Best Practices? GreenDays | 2014-07-01 8 / 33
  • 13.
    Informal and FormalExamples Listing 2: String Literal Initialization p u b l i c c l a s s S t r i n g V a l u e implements Code { p r i v a t e S t r i n g [ ] a r r a y ; p u b l i c void setUp () { a r r a y = new S t r i n g [ 1 0 0 0 ] ; } p u b l i c void doRun () throws Exception { f o r ( i n t i = 0; i < 1000; i ++) { a r r a y [ i ] = " abcdefg . . . " ; } } p u b l i c void tearDown () { a r r a y = n u l l ; } } How Green are Java Best Practices? GreenDays | 2014-07-01 9 / 33
  • 14.
    Informal and FormalExamples Listing 3: String Object Initialization p u b l i c c l a s s S t r i n g O b j e c t implements Code { p r i v a t e S t r i n g [ ] a r r a y ; p u b l i c void setUp () { a r r a y = new S t r i n g [ 1 0 0 0 ] ; } p u b l i c void doRun () throws Exception { f o r ( i n t i = 0; i < 1000; i ++) { a r r a y [ i ] = new S t r i n g ( " abcdefg . . . " ) ; } } p u b l i c void tearDown () { a r r a y = n u l l ; } } How Green are Java Best Practices? GreenDays | 2014-07-01 10 / 33
  • 15.
    Time, Space, EnergySemantics Prefer Literal Initialization time = ft (td , tc ) space = fs (sd , sc ) energy = fe(ed , ec ) How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
  • 16.
    Time, Space, EnergySemantics String Value Initialization Prefer Literal Initialization String Object Initialization time = ft (td , tc ) space = fs (sd , sc ) energy = fe(ed , ec ) How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
  • 17.
    Time, Space, EnergySemantics String Value Initialization Prefer Literal Initialization String Object Initialization time tc space sc energy ec time td space sd energy ed time = ft (td , tc ) space = fs (sd , sc ) energy = fe(ed , ec ) How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
  • 18.
    Time, Space, EnergySemantics String Value Initialization Prefer Literal Initialization String Object Initialization time tc space sc energy ec time td space sd energy ed time = ft (td , tc ) space = fs (sd , sc ) energy = fe(ed , ec ) How Green are Java Best Practices? GreenDays | 2014-07-01 11 / 33
  • 19.
    Time, Space, EnergySemantics Goal: statistical static analysis method and tools original code How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
  • 20.
    Time, Space, EnergySemantics Goal: statistical static analysis method and tools original code How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
  • 21.
    Time, Space, EnergySemantics Goal: statistical static analysis method and tools original code refactored code How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
  • 22.
    Time, Space, EnergySemantics Goal: statistical static analysis method and tools original code refactored code possible savings X joules / X % How Green are Java Best Practices? GreenDays | 2014-07-01 12 / 33
  • 23.
    Measuring Codes 1 Eco-Designand Best Practices 2 Formalizing Practices 3 Measuring Codes Needs and Requirements Measure Task and Process 4 Analyzing Measures, Codes, Practices 5 Eco-Design Indicators How Green are Java Best Practices? GreenDays | 2014-07-01 13 / 33
  • 24.
    Needs and Requirements Needs: Requirements: HowGreen are Java Best Practices? GreenDays | 2014-07-01 14 / 33
  • 25.
    Needs and Requirements Needs: power-meterwith digital outputs Requirements: power-meter with fine-grain precision How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
  • 26.
    Needs and Requirements Needs: power-meterwith digital outputs memory monitor with digital outputs Requirements: power-meter with fine-grain precision How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
  • 27.
    Needs and Requirements Needs: power-meterwith digital outputs memory monitor with digital outputs platform for running Java codes Requirements: power-meter with fine-grain precision Java micro-benchmarking to avoid JIT How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
  • 28.
    Needs and Requirements Needs: power-meterwith digital outputs memory monitor with digital outputs platform for running Java codes system for managing codes and measures Requirements: power-meter with fine-grain precision Java micro-benchmarking to avoid JIT system able to manage physical and logical sensors How Green are Java Best Practices? GreenDays | 2014-07-01 14 / 33
  • 29.
    Measure Task andProcess Measurement Protocol: 1 4 seconds idle 2 10 seconds execution time 3 3 seconds idle How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 30.
    Measure Task andProcess Semantics based on quantitative metrics: x-axis execution time y-axis instant power or instant memory space How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 31.
    Measure Task andProcess Preliminary Computations: How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 32.
    Measure Task andProcess Preliminary Computations: total energy obtained by the trapezoidal rule How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 33.
    Measure Task andProcess Preliminary Computations: total energy obtained by the trapezoidal rule idle power = average of the first 4 second instant powers How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 34.
    Measure Task andProcess Preliminary Computations: total energy obtained by the trapezoidal rule idle power = average of the first 4 second instant powers idle energy = idle power × protocol time How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 35.
    Measure Task andProcess Code energy computation and normalization: code energy = total energy - idle energy How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 36.
    Measure Task andProcess Code energy computation and normalization: code energy = total energy - idle energy normalized code energy = code energy / times of execution How Green are Java Best Practices? GreenDays | 2014-07-01 15 / 33
  • 37.
    Measure Task andProcess Measure Process: How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 38.
    Measure Task andProcess Measure Process: 1 Retrieve an available Java code How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 39.
    Measure Task andProcess Measure Process: 1 Retrieve an available Java code 2 Iterate while this code isn’t mature: How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 40.
    Measure Task andProcess Measure Process: 1 Retrieve an available Java code 2 Iterate while this code isn’t mature: Clean its measure set How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 41.
    Measure Task andProcess Measure Process: 1 Retrieve an available Java code 2 Iterate while this code isn’t mature: Clean its measure set Compute its maturity How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 42.
    Measure Task andProcess Measure Process: 1 Retrieve an available Java code 2 Iterate while this code isn’t mature: Clean its measure set Compute its maturity Plan new measures if required How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 43.
    Measure Task andProcess Measure Process: 1 Retrieve an available Java code 2 Iterate while this code isn’t mature: Clean its measure set Compute its maturity Plan new measures if required Perform these measures 3 Send the report of this code How Green are Java Best Practices? GreenDays | 2014-07-01 16 / 33
  • 44.
    Analyzing Measures, Codes,Practices 1 Eco-Design and Best Practices 2 Formalizing Practices 3 Measuring Codes 4 Analyzing Measures, Codes, Practices Clean and Canonical Measures Code Maturity Results 5 Eco-Design Indicators How Green are Java Best Practices? GreenDays | 2014-07-01 17 / 33
  • 45.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
  • 46.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: disturbances before the measure task underestimate How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
  • 47.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: disturbances before the measure task underestimate disturbances after the measure task overestimate How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
  • 48.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: disturbances before the measure task underestimate disturbances after the measure task overestimate disturbances during the measure task overestimate How Green are Java Best Practices? GreenDays | 2014-07-01 18 / 33
  • 49.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: disturbances before the measure task disturbances after the measure task disturbances during the measure task 2 mere algorithms for cleaning measures: How Green are Java Best Practices? GreenDays | 2014-07-01 19 / 33
  • 50.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: disturbances before the measure task disturbances after the measure task disturbances during the measure task 2 mere algorithms for cleaning measures: bounds checking algorithm (over a single measure) How Green are Java Best Practices? GreenDays | 2014-07-01 19 / 33
  • 51.
    Clean and CanonicalMeasures 3 kinds of measure disturbances: disturbances before the measure task disturbances after the measure task disturbances during the measure task 2 mere algorithms for cleaning measures: bounds checking algorithm (over a single measure) split-and-merge algorithm (over a set of measures) How Green are Java Best Practices? GreenDays | 2014-07-01 19 / 33
  • 52.
    Clean and CanonicalMeasures Cleaning algorithm evaluation: 500 clean measures from 25 rules annotated by 3 experts How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
  • 53.
    Clean and CanonicalMeasures Cleaning algorithm evaluation: 500 clean measures from 25 rules annotated by 3 experts inter-agreement κ: 0.94 (almost perfect) How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
  • 54.
    Clean and CanonicalMeasures Cleaning algorithm evaluation: 500 clean measures from 25 rules annotated by 3 experts inter-agreement κ: 0.94 (almost perfect) baseline = quartile method precision: 0.953 recall: 0.911 How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
  • 55.
    Clean and CanonicalMeasures Cleaning algorithm evaluation: 500 clean measures from 25 rules annotated by 3 experts inter-agreement κ: 0.94 (almost perfect) baseline = quartile method precision: 0.953 recall: 0.911 split-and-merge algorithm precision: 0.941 recall: 1.0 How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
  • 56.
    Clean and CanonicalMeasures Cleaning algorithm evaluation: 500 clean measures from 25 rules annotated by 3 experts inter-agreement κ: 0.94 (almost perfect) baseline = quartile method precision: 0.953 recall: 0.911 split-and-merge algorithm precision: 0.941 recall: 1.0 remove all disturbed measures How Green are Java Best Practices? GreenDays | 2014-07-01 20 / 33
  • 57.
    Clean and CanonicalMeasures Canonical measure: How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
  • 58.
    Clean and CanonicalMeasures Canonical measure: time: t3 space: s3 energy: e3 time: t2 space: s2 energy: e2 time: t1 space: s1 energy: e1 How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
  • 59.
    Clean and CanonicalMeasures Canonical measure: time: t3 space: s3 energy: e3 time: t2 space: s2 energy: e2 time: t1 space: s1 energy: e1 time: t space: s energy: e How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
  • 60.
    Clean and CanonicalMeasures Canonical measure: time: t3 space: s3 energy: e3 time: t2 space: s2 energy: e2 time: t1 space: s1 energy: e1 time: t space: s energy: e How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
  • 61.
    Clean and CanonicalMeasures Canonical measure: time: t3 space: s3 energy: e3 time: t2 space: s2 energy: e2 time: t1 space: s1 energy: e1 time: t space: s energy: e How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
  • 62.
    Clean and CanonicalMeasures Canonical measure: time: t3 space: s3 energy: e3 time: t2 space: s2 energy: e2 time: t1 space: s1 energy: e1 time: t space: s energy: e error margin: 2% How Green are Java Best Practices? GreenDays | 2014-07-01 21 / 33
  • 63.
    Code Maturity Code Maturity Howmany clean measures required for reliable results? How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
  • 64.
    Code Maturity Code Maturity Howmany clean measures required for reliable results? 0 20 40 60 80 100 120 5 10 15 Measure Number RelativeStandardDeviation How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
  • 65.
    Code Maturity Code Maturity Howmany clean measures required for reliable results? 0 20 40 60 80 100 120 5 10 15 Measure Number RelativeStandardDeviation a set of 25 measures minimum How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
  • 66.
    Code Maturity Code Maturity Howmany clean measures required for reliable results? 0 20 40 60 80 100 120 5 10 15 Measure Number RelativeStandardDeviation a set of 25 measures minimum a standard deviation less than 10% How Green are Java Best Practices? GreenDays | 2014-07-01 22 / 33
  • 67.
    Results Energy in nanojoules,time in nanoseconds Memory in kilobytes Standard Deviation on Energy Replace Object Initialization by Literal Initialization Rule Id GreenEnergy GrayEnergy GreenTime GrayTime GreenMemory GrayMemory GreenStdDev GrayStdDev String 697 7885 842 7827 4136 36104 4.40% 8.14% Float 10311 10448 4736 4127 20032 20032 5.85% 6.58% Integer 685 9575 833 4591 4048 20032 5.21% 6.51% Boolean 683 6267 775 4741 4048 20032 4.77% 7.03% Char 695 33067 840 4595 4048 20032 5.04% 4.65% Double 10003 10210 5810 4270 28032 28032 5.58% 7.83% Long 669 8236 807 6066 4056 28032 2.89% 5.32% Short 680 7819 819 3846 4048 20031 4.87% 7.71% How Green are Java Best Practices? GreenDays | 2014-07-01 23 / 33
  • 68.
    Results Replace Object Initializationby Literal Initialization Rule Id G reen Energy G ray Energy A bsolute G ain Relative G ain String 697 7885 7188 91.16% Float 10311 10448 137 1.31% Integer 685 9575 8890 92.54% Boolean 683 6267 5584 89.10% Char 695 33067 32372 97.89% Double 10003 10210 207 2.02% Long 669 8236 7567 91.87% Short 680 7819 7139 91.30% How Green are Java Best Practices? GreenDays | 2014-07-01 24 / 33
  • 69.
    Results Rules for loops APrefer integer loop counters B Avoid method loop conditions C Prefer comparison-to-0 conditions D Prefer first common condition Id GreenEnergy GrayEnergy GreenTime GrayTime GreenMemory GrayMemory GreenStdDev GrayStdDev A 82 98 4744 5931 16 16 8.66% 7.46% B 8376 8602 6181 6364 20056 20056 3.83% 6.14% C 89 284 4709 17367 16 16 5.09% 5.78% D 97 100 4934 5017 16 16 4.37% 4.60% How Green are Java Best Practices? GreenDays | 2014-07-01 25 / 33
  • 70.
    Results Rules for loops APrefer integer loop counters B Avoid method loop conditions C Prefer comparison-to-0 conditions D Prefer first common condition Id G reen Energy G ray Energy A bsolute G ain Relative G ain A 82 98 16 16.32% B 8376 8602 226 2.62% C 89 284 195 68.66% D 97 100 3 3.00% How Green are Java Best Practices? GreenDays | 2014-07-01 25 / 33
  • 71.
    Results Set String Builderor Buffer Size A String Buffer/Builder capacity initialization B String Buffer/Builder capacity setting C String Buffer/Builder length setting Id GreenEnergy GrayEnergy GreenTime GrayTime GreenMemory GrayMemory GreenStdDev GrayStdDev A 593 1053 38085 59111 52056 73784 7.11% 8.40% B 598 1053 38495 59111 52056 73784 7.86% 8.40% C 1211 1053 59111 70765 73784 104064 8.40% 9.40% A’ 378 899 19278 41088 52056 73784 8.27% 7.18% B’ 429 899 41088 51214 73784 104064 7.18% 5.84% C’ 1043 899 20976 41088 52056 73784 6.01% 7.18% How Green are Java Best Practices? GreenDays | 2014-07-01 26 / 33
  • 72.
    Results Set String Builderor Buffer Size A String Buffer/Builder capacity initialization B String Buffer/Builder capacity setting C String Buffer/Builder length setting Id G reen Energy G ray Energy A bsolute G ain Relative G ain A 593 1053 460 43.68% B 598 1053 455 43.20% C 1211 1053 -158 -15.00% A’ 378 899 521 57.95% B’ 429 899 470 52.28% C’ 1043 899 -144 -16.01% How Green are Java Best Practices? GreenDays | 2014-07-01 26 / 33
  • 73.
    Eco-Design Indicators 1 Eco-Designand Best Practices 2 Formalizing Practices 3 Measuring Codes 4 Analyzing Measures, Codes, Practices 5 Eco-Design Indicators Summary Future How Green are Java Best Practices? GreenDays | 2014-07-01 27 / 33
  • 74.
    Eco-Design Indicators How Greenare Java Best Practices? GreenDays | 2014-07-01 28 / 33
  • 75.
    Eco-Design Indicators Hypothesis Best CodingPractices ≈ Eco-Design Rules 174 formalized and measured rules How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
  • 76.
    Eco-Design Indicators Hypothesis Best CodingPractices ≈ Eco-Design Rules 174 formalized and measured rules 55% rules huge savings (more than 10%) How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
  • 77.
    Eco-Design Indicators Hypothesis Best CodingPractices ≈ Eco-Design Rules 174 formalized and measured rules 55% rules huge savings (more than 10%) 20% rules few savings (between 3% and 10%) How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
  • 78.
    Eco-Design Indicators Hypothesis Best CodingPractices ≈ Eco-Design Rules 174 formalized and measured rules 55% rules huge savings (more than 10%) 20% rules few savings (between 3% and 10%) 15% rules no savings (between -3% and 3%) How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
  • 79.
    Eco-Design Indicators Hypothesis Best CodingPractices ≈ Eco-Design Rules 174 formalized and measured rules 55% rules huge savings (more than 10%) 20% rules few savings (between 3% and 10%) 15% rules no savings (between -3% and 3%) 10% rules some losses (less than -3%) How Green are Java Best Practices? GreenDays | 2014-07-01 29 / 33
  • 80.
    Eco-Design Indicators With TheWay: 1 reliable measure system How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 81.
    Eco-Design Indicators With TheWay: 1 reliable measure system hybrid physical and logical sensor management How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 82.
    Eco-Design Indicators With TheWay: 1 reliable measure system hybrid physical and logical sensor management complex client/server architecture How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 83.
    Eco-Design Indicators With TheWay: 1 reliable measure system hybrid physical and logical sensor management complex client/server architecture focused star schema database How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 84.
    Eco-Design Indicators With TheWay: 1 reliable measure system hybrid physical and logical sensor management complex client/server architecture focused star schema database robust automatic iterative process How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 85.
    Eco-Design Indicators With TheWay: 1 reliable measure system hybrid physical and logical sensor management complex client/server architecture focused star schema database robust automatic iterative process extensible programming API How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 86.
    Eco-Design Indicators With TheWay: 1 reliable measure system hybrid physical and logical sensor management complex client/server architecture focused star schema database robust automatic iterative process extensible programming API reliable stable measure sets with few measures How Green are Java Best Practices? GreenDays | 2014-07-01 30 / 33
  • 87.
    Eco-Design Indicators • JérômeRocheteau, Virginie Gaillard, et Lamya Belhaj. How Green are Java Best Coding Practices? Proceedings of the 3rd International Conference on Smart Grids and Green IT Systems, pages 235–246. Barcelona, Espagne, Avril 2014. How Green are Java Best Practices? GreenDays | 2014-07-01 31 / 33
  • 88.
    Future 1 Energy EfficiencyClasses? How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 89.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 90.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 91.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings Relative savings How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 92.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings Relative savings 3 Rule indicators in different environments How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 93.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings Relative savings 3 Rule indicators in different environments 4 Rule indicators in different programming languages How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 94.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings Relative savings 3 Rule indicators in different environments 4 Rule indicators in different programming languages 5 Energy efficiency of different programming languages How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 95.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings Relative savings 3 Rule indicators in different environments 4 Rule indicators in different programming languages 5 Energy efficiency of different programming languages 6 Accuracy of different physical and/or logical sensors How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 96.
    Future 1 Energy EfficiencyClasses? 2 Eco-Design Indicators? Absolute savings Relative savings 3 Rule indicators in different environments 4 Rule indicators in different programming languages 5 Energy efficiency of different programming languages 6 Accuracy of different physical and/or logical sensors 7 Energy and memory footprints of logical sensors How Green are Java Best Practices? GreenDays | 2014-07-01 32 / 33
  • 97.
    Thank you How Greenare Java Best Practices? GreenDays | 2014-07-01 33 / 33
  • 98.
    Data Model How Greenare Java Best Practices? GreenDays | 2014-07-01 33 / 33