Skip to content

Commit 53227ea

Browse files
AbhinabKanrarzhendrikse
authored andcommitted
manual alorithm (eugenp#2096)
* moving jmh into libraries module * refactoring jmh * Update pom.xml * manual algorightm * with BM result * fix for space issue * Fixed indentation
1 parent 547b585 commit 53227ea

4 files changed

Lines changed: 46 additions & 3 deletions

File tree

‎libraries/src/main/java/com/baeldung/jmh/JmhDemo.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import org.openjdk.jmh.runner.RunnerException;
77

88
public class JmhDemo {
9-
109
public static void main(String[] args) throws RunnerException, IOException {
11-
Main.main(args);
10+
Main.main(args);
1211
}
13-
1412
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.baeldung.jmh.warmup;
2+
3+
public class MainApplication {
4+
5+
static long start;
6+
static long end;
7+
8+
static {
9+
ManualClassLoader.load();
10+
}
11+
12+
public static void main(String[] args) {
13+
start = System.nanoTime();
14+
ManualClassLoader.load();
15+
end = System.nanoTime();
16+
System.out.println("Total time taken : " + (end - start));
17+
}
18+
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.baeldung.jmh.warmup;
2+
3+
import com.baeldung.jmh.warmup.dummy.Dummy;
4+
5+
public class ManualClassLoader {
6+
7+
public static void load() {
8+
9+
for (int i = 0; i < 100000; i++) {
10+
// load all(or most) important classes
11+
Dummy dummy = new Dummy();
12+
dummy.m();
13+
}
14+
15+
}
16+
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.jmh.warmup.dummy;
2+
3+
public class Dummy {
4+
5+
public void m() {
6+
7+
}
8+
9+
}

0 commit comments

Comments
 (0)