MCPcopy Create free account
hub / github.com/catid/supercharger / benchmark_docker_execute

Function benchmark_docker_execute

codegen/test_docker_execute.py:19–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18# Set up the benchmarking function
19def benchmark_docker_execute():
20 print("Setting up...")
21
22 docker_execute = DockerExecute(sources_dirname=sources_dirname)
23
24 print("Priming the pump...")
25
26 # Prime the pump
27 exit_code, output = docker_execute.execute(test_script)
28 assert output == expected_output, f"Unexpected output: {output}"
29 assert exit_code == 0, f"Unexpected exit code: {exit_code}"
30
31 print("Benchmarking...")
32
33 try:
34 # Measure the execution time of the method
35 exec_time = timeit.timeit(
36 lambda: docker_execute.execute(test_script), number=4
37 )
38 finally:
39 # Clean up the Docker container
40 docker_execute.shutdown()
41
42 return exec_time
43
44# Run the benchmark
45exec_time = benchmark_docker_execute()

Callers 1

Calls 3

executeMethod · 0.95
shutdownMethod · 0.95
DockerExecuteClass · 0.90

Tested by

no test coverage detected