예제 #1
0
        for ($j = 0; $j < $cols; $j++) {
            switch ($j % 3) {
                case 0:
                    $row[] = $i;
                    break;
                case 1:
                    $row[] = '(' . $i . ',' . $j . ')';
                    break;
                case 2:
                    $row[] = new DateTime('2014-01-01');
                    break;
            }
        }
        $data[] = $row;
    }
    $start = microtime(true);
    $dataTable = new Svrnm\ExcelDataTables\ExcelDataTable();
    $dataTable->showHeaders();
    $dataTable->addRows($data);
    $time0 = microtime(true) - $start;
    $dataTable->attachToFile($in, $out);
    $time1 = microtime(true) - $start;
    $lastPeak = memory_get_peak_usage();
    echo $rows . ' x ' . $cols . ":\t";
    echo $time0 . " s\t";
    echo $time1 . " s\t";
    echo floor($rows / $time1) . " rows/s\t";
    echo floor($rows * $cols / $time1) . " entries/s\t";
    echo $lastPeak / (1024 * 1024) . ' MB' . PHP_EOL;
    $rows *= 2;
}