renamed all modules
This commit is contained in:
42
testdata/src/main/java/perf/one/Caller.java
vendored
Normal file
42
testdata/src/main/java/perf/one/Caller.java
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package perf.one;
|
||||
|
||||
public class Caller {
|
||||
|
||||
Target target = new Target();
|
||||
|
||||
public long run() {
|
||||
long stime = System.nanoTime();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
target.foo();
|
||||
}
|
||||
// int total = 0;
|
||||
// for (int i = 0; i < 8000000; i++) {
|
||||
// total += target.bar(123);
|
||||
// }
|
||||
// for (int i = 0; i < 8000000; i++) {
|
||||
// target.goo("abc", 123);
|
||||
// }
|
||||
return (System.nanoTime() - stime);
|
||||
}
|
||||
|
||||
public void warmup() {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] argv) {
|
||||
Caller c = new Caller();
|
||||
c.warmup();
|
||||
System.out.println("real run");
|
||||
c.execute();
|
||||
c.execute();
|
||||
c.execute();
|
||||
c.execute();
|
||||
c.execute();
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
System.out.println((run() / 1000000.0d) + "ms");
|
||||
}
|
||||
}
|
||||
42
testdata/src/main/java/perf/one/CallerB.java
vendored
Normal file
42
testdata/src/main/java/perf/one/CallerB.java
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package perf.one;
|
||||
|
||||
public class CallerB {
|
||||
|
||||
TargetB target = new TargetB();
|
||||
|
||||
public long run() {
|
||||
long stime = System.nanoTime();
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
target.foo();
|
||||
}
|
||||
// int total = 0;
|
||||
// for (int i = 0; i < 8000000; i++) {
|
||||
// total += target.bar(123);
|
||||
// }
|
||||
// for (int i = 0; i < 8000000; i++) {
|
||||
// target.goo("abc", 123);
|
||||
// }
|
||||
return (System.nanoTime() - stime);
|
||||
}
|
||||
|
||||
public void warmup() {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] argv) {
|
||||
CallerB c = new CallerB();
|
||||
c.warmup();
|
||||
System.out.println("real run");
|
||||
c.execute();
|
||||
c.execute();
|
||||
c.execute();
|
||||
c.execute();
|
||||
c.execute();
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
System.out.println((run() / 1000000.0d) + "ms");
|
||||
}
|
||||
}
|
||||
22
testdata/src/main/java/perf/one/Target.java
vendored
Normal file
22
testdata/src/main/java/perf/one/Target.java
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
package perf.one;
|
||||
|
||||
public class Target {
|
||||
|
||||
int j;
|
||||
|
||||
public void foo() {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
j = 5;
|
||||
}
|
||||
}
|
||||
|
||||
public int bar(int i) {
|
||||
j = 5;
|
||||
return i;
|
||||
}
|
||||
|
||||
public void goo(String s, int i) {
|
||||
j = 5;
|
||||
}
|
||||
|
||||
}
|
||||
22
testdata/src/main/java/perf/one/TargetB.java
vendored
Normal file
22
testdata/src/main/java/perf/one/TargetB.java
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
package perf.one;
|
||||
|
||||
public class TargetB {
|
||||
|
||||
int j;
|
||||
|
||||
public void foo() {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
j = 5;
|
||||
}
|
||||
}
|
||||
|
||||
public int bar(int i) {
|
||||
j = 5;
|
||||
return i;
|
||||
}
|
||||
|
||||
public void goo(String s, int i) {
|
||||
j = 5;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user