manual alorithm (#2096)
* moving jmh into libraries module * refactoring jmh * Update pom.xml * manual algorightm * with BM result * fix for space issue * Fixed indentation
This commit is contained in:
parent
547b5850fb
commit
53227eaf0e
|
@ -6,9 +6,7 @@ import org.openjdk.jmh.Main;
|
|||
import org.openjdk.jmh.runner.RunnerException;
|
||||
|
||||
public class JmhDemo {
|
||||
|
||||
public static void main(String[] args) throws RunnerException, IOException {
|
||||
Main.main(args);
|
||||
Main.main(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.baeldung.jmh.warmup;
|
||||
|
||||
public class MainApplication {
|
||||
|
||||
static long start;
|
||||
static long end;
|
||||
|
||||
static {
|
||||
ManualClassLoader.load();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
start = System.nanoTime();
|
||||
ManualClassLoader.load();
|
||||
end = System.nanoTime();
|
||||
System.out.println("Total time taken : " + (end - start));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.baeldung.jmh.warmup;
|
||||
|
||||
import com.baeldung.jmh.warmup.dummy.Dummy;
|
||||
|
||||
public class ManualClassLoader {
|
||||
|
||||
public static void load() {
|
||||
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
// load all(or most) important classes
|
||||
Dummy dummy = new Dummy();
|
||||
dummy.m();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.baeldung.jmh.warmup.dummy;
|
||||
|
||||
public class Dummy {
|
||||
|
||||
public void m() {
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue