22 */ |
22 */ |
23 package org.graalvm.compiler.microbenchmarks.graal; |
23 package org.graalvm.compiler.microbenchmarks.graal; |
24 |
24 |
25 import java.util.Arrays; |
25 import java.util.Arrays; |
26 |
26 |
|
27 import org.graalvm.compiler.phases.schedule.SchedulePhase; |
27 import org.openjdk.jmh.annotations.Benchmark; |
28 import org.openjdk.jmh.annotations.Benchmark; |
|
29 import org.openjdk.jmh.annotations.Measurement; |
28 import org.openjdk.jmh.annotations.Warmup; |
30 import org.openjdk.jmh.annotations.Warmup; |
29 |
31 |
30 import org.graalvm.compiler.microbenchmarks.graal.util.MethodSpec; |
32 import org.graalvm.compiler.microbenchmarks.graal.util.MethodSpec; |
31 import org.graalvm.compiler.microbenchmarks.graal.util.ScheduleState; |
33 import org.graalvm.compiler.microbenchmarks.graal.util.ScheduleState; |
32 import org.graalvm.compiler.nodes.cfg.ControlFlowGraph; |
34 import org.graalvm.compiler.nodes.cfg.ControlFlowGraph; |
33 import org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy; |
35 import org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy; |
34 |
36 |
35 @Warmup(iterations = 15) |
37 @Warmup(iterations = 20) |
|
38 @Measurement(iterations = 10) |
36 public class SchedulePhaseBenchmark extends GraalBenchmark { |
39 public class SchedulePhaseBenchmark extends GraalBenchmark { |
37 |
40 |
38 @MethodSpec(declaringClass = String.class, name = "equals") |
41 @MethodSpec(declaringClass = String.class, name = "equals") |
39 public static class StringEquals extends ScheduleState { |
42 public static class StringEquals extends ScheduleState { |
40 } |
43 } |
115 |
118 |
116 @Benchmark |
119 @Benchmark |
117 public void intersection_EARLIEST_OPTIMAL(IntersectionState_EARLIEST_OPTIMAL s) { |
120 public void intersection_EARLIEST_OPTIMAL(IntersectionState_EARLIEST_OPTIMAL s) { |
118 s.schedule.apply(s.graph); |
121 s.schedule.apply(s.graph); |
119 } |
122 } |
|
123 |
|
124 @MethodSpec(declaringClass = SchedulePhaseBenchmark.class, name = "intersectionSnippet") |
|
125 public static class IntersectionState_EARLIEST_WITH_GUARD_ORDER_OPTIMAL extends ScheduleState { |
|
126 public IntersectionState_EARLIEST_WITH_GUARD_ORDER_OPTIMAL() { |
|
127 super(SchedulingStrategy.EARLIEST_WITH_GUARD_ORDER); |
|
128 } |
|
129 } |
|
130 |
|
131 @Benchmark |
|
132 public void intersection_EARLIEST_WITH_GUARD_ORDER_OPTIMAL(IntersectionState_EARLIEST_WITH_GUARD_ORDER_OPTIMAL s) { |
|
133 s.schedule.apply(s.graph); |
|
134 } |
|
135 // Checkstyle: resume method name check |
|
136 |
|
137 // Checkstyle: stop method name check |
|
138 @MethodSpec(declaringClass = SchedulePhase.Instance.class, name = "scheduleEarliestIterative") |
|
139 public static class ScheduleEarliestIterative_LATEST_OPTIMAL extends ScheduleState { |
|
140 public ScheduleEarliestIterative_LATEST_OPTIMAL() { |
|
141 super(SchedulingStrategy.LATEST); |
|
142 } |
|
143 } |
|
144 |
|
145 @Benchmark |
|
146 public void scheduleEarliestIterative_LATEST_OPTIMAL(ScheduleEarliestIterative_LATEST_OPTIMAL s) { |
|
147 s.schedule.apply(s.graph); |
|
148 } |
|
149 |
|
150 @MethodSpec(declaringClass = SchedulePhase.Instance.class, name = "scheduleEarliestIterative") |
|
151 public static class ScheduleEarliestIterative_LATEST_OUT_OF_LOOPS_OPTIMAL extends ScheduleState { |
|
152 public ScheduleEarliestIterative_LATEST_OUT_OF_LOOPS_OPTIMAL() { |
|
153 super(SchedulingStrategy.LATEST_OUT_OF_LOOPS); |
|
154 } |
|
155 } |
|
156 |
|
157 @Benchmark |
|
158 public void scheduleEarliestIterative_LATEST_OUT_OF_LOOPS_OPTIMAL(ScheduleEarliestIterative_LATEST_OUT_OF_LOOPS_OPTIMAL s) { |
|
159 s.schedule.apply(s.graph); |
|
160 } |
|
161 |
|
162 @MethodSpec(declaringClass = SchedulePhase.Instance.class, name = "scheduleEarliestIterative") |
|
163 public static class ScheduleEarliestIterative_EARLIEST_OPTIMAL extends ScheduleState { |
|
164 public ScheduleEarliestIterative_EARLIEST_OPTIMAL() { |
|
165 super(SchedulingStrategy.EARLIEST); |
|
166 } |
|
167 } |
|
168 |
|
169 @Benchmark |
|
170 public void scheduleEarliestIterative_EARLIEST_OPTIMAL(ScheduleEarliestIterative_EARLIEST_OPTIMAL s) { |
|
171 s.schedule.apply(s.graph); |
|
172 } |
|
173 |
|
174 @MethodSpec(declaringClass = SchedulePhase.Instance.class, name = "scheduleEarliestIterative") |
|
175 public static class ScheduleEarliestIterative_EARLIEST_WITH_GUARD_ORDER_OPTIMAL extends ScheduleState { |
|
176 public ScheduleEarliestIterative_EARLIEST_WITH_GUARD_ORDER_OPTIMAL() { |
|
177 super(SchedulingStrategy.EARLIEST_WITH_GUARD_ORDER); |
|
178 } |
|
179 } |
|
180 |
|
181 @Benchmark |
|
182 public void scheduleEarliestIterative_EARLIEST_WITH_GUARD_ORDER_OPTIMAL(ScheduleEarliestIterative_EARLIEST_WITH_GUARD_ORDER_OPTIMAL s) { |
|
183 s.schedule.apply(s.graph); |
|
184 } |
120 // Checkstyle: resume method name check |
185 // Checkstyle: resume method name check |
121 } |
186 } |