Skip to content

Commit ea83644

Browse files
committed
No need to enter a context for DynamicObject benchmarking.
1 parent 14bbf98 commit ea83644

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

truffle/src/org.graalvm.truffle.benchmark/src/org/graalvm/truffle/benchmark/DynamicObjectBenchmark.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@
4343
import java.lang.invoke.MethodHandles;
4444
import java.util.stream.IntStream;
4545

46-
import org.graalvm.polyglot.Context;
47-
import org.graalvm.polyglot.Engine;
4846
import org.openjdk.jmh.annotations.Benchmark;
4947
import org.openjdk.jmh.annotations.CompilerControl;
5048
import org.openjdk.jmh.annotations.Param;
5149
import org.openjdk.jmh.annotations.Scope;
5250
import org.openjdk.jmh.annotations.Setup;
5351
import org.openjdk.jmh.annotations.State;
54-
import org.openjdk.jmh.annotations.TearDown;
5552
import org.openjdk.jmh.annotations.Threads;
5653
import org.openjdk.jmh.annotations.Warmup;
5754

@@ -62,7 +59,6 @@
6259
@Warmup(iterations = 10, time = 1)
6360
public class DynamicObjectBenchmark extends TruffleBenchmark {
6461

65-
static final String TEST_LANGUAGE = "benchmark-test-language";
6662
private static final int PROPERTY_KEYS_PER_ITERATION = 1000;
6763
static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
6864

@@ -92,15 +88,9 @@ private static final class MyDynamicObjectWithFields extends DynamicObject {
9288

9389
@State(Scope.Benchmark)
9490
public static class SharedEngineState {
95-
final Engine engine = Engine.newBuilder().allowExperimentalOptions(true).option("engine.Compilation", "false").build();
9691
final Shape rootShape = Shape.newBuilder().layout(MyDynamicObject.class, LOOKUP).build();
9792
final Shape[] expectedShapes = new Shape[PROPERTY_KEYS_PER_ITERATION];
9893

99-
@TearDown
100-
public void tearDown() {
101-
engine.close();
102-
}
103-
10494
private void assertSameShape(int i, Shape actualShape) {
10595
Shape expectedShape = expectedShapes[i];
10696
if (expectedShape == null) {
@@ -113,26 +103,16 @@ private void assertSameShape(int i, Shape actualShape) {
113103

114104
@State(Scope.Thread)
115105
public static class PerThreadContextState {
116-
Context context;
117106
DynamicObject object;
118107

119108
@Setup
120109
public void setup(SharedEngineState shared) {
121-
context = Context.newBuilder(TEST_LANGUAGE).engine(shared.engine).build();
122-
context.enter();
123-
124110
object = new MyDynamicObject(shared.rootShape);
125111
for (int i = 0; i < PROPERTY_KEYS_PER_ITERATION; i++) {
126112
String key = PROPERTY_KEYS[i];
127113
DynamicObject.PutNode.getUncached().put(object, key, "testValue");
128114
}
129115
}
130-
131-
@TearDown
132-
public void tearDown() {
133-
context.leave();
134-
context.close();
135-
}
136116
}
137117

138118
/**

0 commit comments

Comments
 (0)