Skip to content

Commit df66293

Browse files
committed
[benchmarks] Merge init benchmarks and add GCC + loop_tool.
This adds gcc-v0 and the loop_tool-v0 environments to the gym.make(...) benchmark, and removes the benchmark for environment initialization from an existing service, as that is now the default behavior when using ServiceConnectionPools.
1 parent 028dd7d commit df66293

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

benchmarks/bench_test.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
import gym
2121
import pytest
2222

23-
import examples.example_compiler_gym_service as dummy
24-
from compiler_gym.envs import CompilerEnv, LlvmEnv, llvm
25-
from compiler_gym.service import CompilerGymServiceConnection, ConnectionOpts
23+
import examples.example_compiler_gym_service # noqa Environment import.
24+
from compiler_gym.envs import CompilerEnv
2625
from tests.pytest_plugins.llvm import OBSERVATION_SPACE_NAMES, REWARD_SPACE_NAMES
2726
from tests.test_main import main
2827

@@ -45,31 +44,13 @@ def env(request) -> CompilerEnv:
4544

4645
@pytest.mark.parametrize(
4746
"env_id",
48-
["llvm-v0", "example-cc-v0", "example-py-v0"],
49-
ids=["llvm", "dummy-cc", "dummy-py"],
47+
["llvm-v0", "example-cc-v0", "example-py-v0", "loop_tool-v0"],
48+
ids=["llvm", "dummy-cc", "dummy-py", "loop_tool"],
5049
)
51-
def test_make_local(benchmark, env_id):
50+
def test_make_env(benchmark, env_id):
5251
benchmark(lambda: gym.make(env_id).close())
5352

5453

55-
@pytest.mark.parametrize(
56-
"args",
57-
[
58-
(llvm.LLVM_SERVICE_BINARY, LlvmEnv),
59-
(dummy.EXAMPLE_CC_SERVICE_BINARY, CompilerEnv),
60-
(dummy.EXAMPLE_PY_SERVICE_BINARY, CompilerEnv),
61-
],
62-
ids=["llvm", "dummy-cc", "dummy-py"],
63-
)
64-
def test_make_service(benchmark, args):
65-
service_binary, env_class = args
66-
service = CompilerGymServiceConnection(service_binary, ConnectionOpts())
67-
try:
68-
benchmark(lambda: env_class(service=service.connection.url).close())
69-
finally:
70-
service.close()
71-
72-
7354
@pytest.mark.parametrize(
7455
"make_env",
7556
[

0 commit comments

Comments
 (0)