$testdescriptions = [1 => 'Create single object (incl autoload time)', 2 => 'Create single object (excl autoload time)', 3 => 'Create deep object graph', 4 => 'Fetch the same instance (service) from the container repeatedly', 5 => 'Inject a service into a new object repeatedly'];
for ($test = 1; $test <= $numTests; $test++) {
    $html .= '<h2>Test ' . $test . ' - ' . $testdescriptions[$test] . '</h2>';
    $html .= '<table data-graph-container-before="1" data-graph-type="column">';
    cliPrint('Starting test:' . $test);
    $containerInfo = [];
    $html .= '<thead><tr><th>Container</th><th>Time</th><th>Memory</th><th>Files</th></thead>';
    foreach ($containers as $container) {
        cliPrint('');
        cliPrint('Benchmarking container:' . $container);
        $memory = [];
        $time = [];
        $files = [];
        $output = [];
        for ($i = 0; $i < $runs; $i++) {
            cliPrint($container . ' test' . $test . ' : ' . ($i + 1) . '/' . $runs);
            $output = runScript('./' . $container . '/test' . $test . '.php', $inis[$container]);
            $result = json_decode($output[0]);
            if (!is_object($result)) {
                echo $container . $test . '<br />';
            }
            $time[] = $result->time;
            $memory[] = $result->memory;
            $files[] = $result->files;
        }
        $containerInfo[] = ['name' => $container, 'time' => average($time), 'memory' => average($memory), 'files' => average($files)];
    }
    //Sort the results by time
    usort($containerInfo, function ($a, $b) {
        if ($a['time'] == $b['time']) {
            return $a['memory'] < $b['memory'] ? -1 : 1;
$html .= '<thead><tr><th>Container</th>';
//The number of J objects on each iteration for the tests. Each J object consists of 10 objects in total
$objects = [1, 5, 10, 20, 50, 100, 150];
foreach ($objects as $object) {
    $html .= '<th>' . $object * 10 . ' objects</th>';
}
$html .= '</thead>';
cliPrint('Starting benchmark');
foreach ($containers as $container) {
    cliPrint('Benchmarking container: ' . $container);
    $html .= '<tr>';
    $html .= '<td>' . $container . '</td>';
    foreach ($objects as $objectcount) {
        $results = [];
        for ($i = 0; $i < $runs; $i++) {
            cliPrint('Benchmarking container: ' . $container . ' with ' . $objectcount * 10 . ' objects run ' . $i . '/' . $runs);
            $t1 = microtime(true);
            for ($j = 0; $j < $iterations; $j++) {
                $output = runScript($container . '/test6a.php', $inis[$container], [$objectcount]);
            }
            $t2 = microtime(true);
            $test = json_decode($output[0]);
            if (!is_object($test)) {
                print_r($output);
            }
            $results[] = $t2 - $t1;
        }
        $result = average($results);
        $html .= '<td>' . ($result - $overhead) . '</td>';
    }
    $html .= '</tr>';