tacco.benchmarking.benchmark_script

benchmark_script(script, working_directory=None, verbose=0)[source]

Benchmarks time and memory consumption of a python script.

Parameters:
  • script – A string specifying the python script code to be measured.

  • working_directory – The directory where to execute the command. If None, a temporary directory is used and cleaned in the end.

  • verbose – Whether to print stderr and stdout of the command run.

Returns:

Returns a dict containing the runtime in seconds under the key “shell_time_s” and the memory usage under “max_mem_usage_GB”.