File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change 11
11
public class SimulatorBenchmark {
12
12
13
13
@ State (Scope .Thread )
14
- public static class MyState {
14
+ public static class DefaultSetup {
15
15
16
16
Simulator simulator ;
17
17
BWAPI4JAgentFactory factory = new BWAPI4JAgentFactory (null );
@@ -29,6 +29,25 @@ public void setup() {
29
29
}
30
30
}
31
31
32
+ @ State (Scope .Thread )
33
+ public static class WithFrameSkipFour {
34
+
35
+ Simulator simulator ;
36
+ BWAPI4JAgentFactory factory = new BWAPI4JAgentFactory (null );
37
+
38
+ @ Setup (Level .Invocation )
39
+ public void setup () {
40
+ simulator = new Simulator (4 );
41
+
42
+ for (int i = 0 ; i < 30 ; i ++) {
43
+ simulator .addAgentA (factory .of (UnitType .Zerg_Mutalisk ));
44
+ }
45
+ for (int i = 0 ; i < 30 ; i ++) {
46
+ simulator .addAgentB (factory .of (UnitType .Zerg_Hydralisk ));
47
+ }
48
+ }
49
+ }
50
+
32
51
static {
33
52
try {
34
53
BWDataProvider .injectValues ();
@@ -38,12 +57,17 @@ public void setup() {
38
57
}
39
58
40
59
@ Benchmark
41
- public int _30MutasVs30Hydras (MyState state ) {
60
+ public int _30MutasVs30Hydras (DefaultSetup state ) {
61
+ return state .simulator .simulate (-1 );
62
+ }
63
+
64
+ @ Benchmark
65
+ public int _30MutasVs30Hydras_fs4 (WithFrameSkipFour state ) {
42
66
return state .simulator .simulate (-1 );
43
67
}
44
68
45
69
@ Benchmark
46
- public int clearCollisionMaps (MyState state ) {
70
+ public int clearCollisionMaps (DefaultSetup state ) {
47
71
state .simulator .reset ();
48
72
return state .simulator .getAgentsA ().size () + state .simulator .getAgentsB ().size ();
49
73
}
You can’t perform that action at this time.
0 commit comments