Perf dashboard's runs API uses more than 128MB of memory
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Nov 2015 20:39:34 +0000 (20:39 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Nov 2015 20:39:34 +0000 (20:39 +0000)
commit619a6d0b153870fb64d26738659b08c4cb2633aa
tree476ec917b03c1d084758a2a083205e888c6fb39d
parentd36cab0992261d1e30fc70e63dc867300306630f
Perf dashboard's runs API uses more than 128MB of memory
https://bugs.webkit.org/show_bug.cgi?id=151478

Reviewed by Andreas Kling.

Don't fetch all query results at once to avoid using twice as much memory as needed.
Use iterative API to format each result at a time.

This change is also a 5% runtime performance gain.

* public/api/runs.php:
(RunsGenerator::__construct): Takes a Database instance instead of a list of configurations. The latter is
no longer needed as we pass in each configuration type explicitly to fetch_runs.
(RunsGenerator::fetch_runs): Renamed from add_runs since it now executes the database query via execute_query.
Also moved the logic to compute the last modified time here.
(RunsGenerator::execute_query): Moved from fetch_runs_for_config. Use Database::query instead of query_and_fetch_all.
(RunsGeneratorForTestGroup):
(RunsGeneratorForTestGroup::__construct):
(RunsGeneratorForTestGroup::execute_query): Moved from fetch_runs_for_config_and_test_group.

* public/include/db.php:
(generate_data_file): Lock the file to avoid corruption.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192691 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/api/runs.php
Websites/perf.webkit.org/public/include/db.php