Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2016 2017 #1

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1634e4f
adding figure
cgravier Feb 23, 2016
ac9ffc0
add image
cgravier Feb 23, 2016
537eaf1
add image
cgravier Feb 23, 2016
f28cecf
Update README.md
cgravier Feb 23, 2016
e1fdf89
labs project structure
cgravier Feb 23, 2016
3aa9ff9
Merge branch '2015-2016' of https://github.com/telecom-se/hpp into 20…
cgravier Feb 23, 2016
3de6b2a
introduction
cgravier Feb 23, 2016
b2cdc9f
Updated README.md
cgravier Feb 25, 2016
e3de0a9
Updated README.md
cgravier Feb 25, 2016
069113e
Updated README.md
cgravier Feb 25, 2016
d9b52f7
Updated README.md
cgravier Feb 25, 2016
57dc5c6
Updated README.md
cgravier Feb 25, 2016
e4e38d4
illustration
cgravier Feb 25, 2016
ca80db3
illustration
cgravier Feb 25, 2016
d5d24c2
Update README.md
cgravier Mar 1, 2016
2c87c9c
Update README.md
cgravier Mar 1, 2016
d6c21e3
Update README.md
cgravier Mar 1, 2016
9b939c6
Update README.md
cgravier Mar 1, 2016
2c10207
Update README.md
cgravier Mar 1, 2016
b11b771
Update README.md
cgravier Mar 1, 2016
15dbef8
Update README.md
cgravier Mar 1, 2016
218e699
Update README.md
cgravier Mar 1, 2016
6fe6021
Update README.md
cgravier Mar 1, 2016
1a24bb9
Update README.md
cgravier Mar 1, 2016
761679a
Update README.md
Mar 14, 2016
5cc4420
Update README.md
cgravier Mar 21, 2016
cda108d
Update README.md
cgravier Mar 21, 2016
e606fe5
Update README.md
cgravier Mar 21, 2016
f19631e
Update README.md
cgravier Mar 21, 2016
398bc25
Update README.md
cgravier Mar 21, 2016
a871d17
Update README.md
cgravier Mar 21, 2016
e824bb5
Update README.md
cgravier Mar 21, 2016
eba58d7
Update README.md
cgravier Mar 21, 2016
fbd098b
Update README.md
cgravier Mar 21, 2016
00085dc
Update README.md
cgravier Mar 21, 2016
6a1af25
multithreading
Apr 27, 2016
01164ad
Update README.md
cgravier Mar 3, 2017
238527f
Sequential and random walks for arrays updated in Java
cgravier Mar 3, 2017
a2f4e85
typo
cgravier Mar 3, 2017
e4ad267
On linkedlist task with contiguous and non-contiguous memory layout f…
cgravier Mar 3, 2017
db26b2f
On automatic optimisations and SIMD
cgravier Mar 3, 2017
95a7ad2
Update README.md
cgravier Mar 3, 2017
e9cc102
Added branch prediction
cgravier Mar 6, 2017
3f974cf
Update README.md
cgravier Mar 6, 2017
e78e463
Plugging JMH session
cgravier Mar 6, 2017
ccc5b3f
Update README.md
cgravier Mar 6, 2017
fb7aaea
introduces and motivates benchmarking framework
cgravier Mar 6, 2017
56e9328
Update README.md
cgravier Mar 7, 2017
77f5cd0
Update README.md
Apr 19, 2017
33593d0
new MT TP
Apr 25, 2017
6d366ed
remove files
Apr 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
introduces and motivates benchmarking framework
cgravier authored Mar 6, 2017
commit fb7aaeae35d7a13aca618bd7ba53a09a717c5c03
16 changes: 14 additions & 2 deletions lab1/README.md
Original file line number Diff line number Diff line change
@@ -174,9 +174,21 @@ Hint: it is significantly different for C/C++ and Java.




# Discover JMH : Don't predict, measure !

From previous activities, you may have understood that running several times the same code does not yield the same execution time. There are indeed some variations between two runs that are natural. This is however not the only reason in the variance you observe and the problem posed by `nanoTime()`.

First, we had learn that the JIT compiler made it so that it not very likely that the code you write is actually what is executed. When we are using `nanoTime()`function, we expect to measure what is between the two timestamp `start`and `end`. Actually, the JIT can go as far as deleting some part of our code that is unnecessary (see [dead code elimination ](http://www.compileroptimizations.com/category/dead_code_elimination.htm)). By comparing two pieces of code using this method, we may have surprising results just because the JIT compiler made optimisations that ruins the benchmark.

Second, `nanoTime()`is not precise enough to measure operations that run in ... nanoseconds. This method is not made to be used for benchmarking things, because (see [Nanotrusting the Nanotime](https://shipilev.net/blog/2014/nanotrusting-nanotime/))):
* It has a cost (15 to 30 ns per call)
* Its resolution is *not* nanoseconds but a 30 ns resolution.
* It's a scalability bottleneck

As a consequence, benchmarking framework exists not only to ease the development of benchmarks but also to act to fight the pitfalls of JIT optimisations and `nanoTime()`when it comes to benchmarking.

What we couldn't encompass everything at the beginig of this course, this is now the right time to get our hands on a practical and efficient benchmarking framework. In what follows, we will investigate and practice one of the most popular Java microbenchmarking framework, aka [JMH](http://openjdk.java.net/projects/code-tools/jmh/).

### Introduction
This is the main part of the work in this lab.
You are invited to first read the nice introduction from [Mikhail Vorontsov](http://java-performance.info/author/Mike/) located [here](http://java-performance.info/jmh/).
@@ -186,7 +198,7 @@ In this lab, we will benchmark two ways of computing the sum of a [List](http://
We will actually compare naive implementations on digit lists that are implemented using for the first solution [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html) and for the second [LinkedList](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html).


### Work to do 1/2 : Use JMH in a stand alone project
### JMH example

1. Create a JMH project using the 1.8 JMH online archetype.