Importing example_problems/hello as a zip takes about 10 seconds, and almost all of that time seems spent importing the submissions.
I think the problem is the double for loop over the files in the zip at
|
for ($j = 0; $j < $zip->numFiles; $j++) { |
|
$path = $zip->getNameIndex($j); |
|
if (!Utils::startsWith($path, 'submissions/')) { |
|
// Skipping non-submission files silently. |
|
continue; |
|
} |
|
$pathComponents = explode('/', $path); |
|
if (!((count($pathComponents) == 3 && !empty($pathComponents[2])) || |
|
(count($pathComponents) == 4 && empty($pathComponents[3])))) { |
|
// Skipping files and directories at the wrong level. |
|
// Note that multi-file submissions sit in a subdirectory. |
|
continue; |
|
} |
|
|
|
if (count($pathComponents) == 3) { |
|
// Single file submission |
|
$files = [$pathComponents[2]]; |
|
$indices = [$j]; |
|
} else { |
|
// Multi file submission |
|
$files = []; |
|
$indices = []; |
|
$length = mb_strrpos($path, '/') + 1; |
|
$prefix = mb_substr($path, 0, $length); |
|
for ($k = 0; $k < $zip->numFiles; $k++) { |
, which may become slow when there's in the case of
hello 223 files/directories in the zip file.
Importing
example_problems/helloas a zip takes about 10 seconds, and almost all of that time seems spent importing the submissions.I think the problem is the double for loop over the files in the zip at
domjudge/webapp/src/Service/ImportProblemService.php
Lines 635 to 659 in 01b754a
hello223 files/directories in the zip file.