Huuuge speedup in the Hydra evaluator

The check to see whether a build had been scheduled in a previous
evaluation took about 200 ms for the nixpkgs:trunk jobset.  Given
that it has more than 15000 builds, this added up to a lot.  Now
it takes 0.2 ms per build.
This commit is contained in:
Eelco Dolstra 2012-04-04 17:29:03 +02:00
parent 1cdc023427
commit 8b88ce19c2

View file

@ -837,7 +837,13 @@ sub checkBuild {
# account. For instance, do we want a new build to be
# scheduled if the meta.maintainers field is changed?
if (defined $prevEval) {
my ($prevBuild) = $prevEval->builds->search({ job => $job->name, outPath => $outPath }, { rows => 1, columns => ['id'] });
my ($prevBuild) = $prevEval->builds->search(
# The "project" and "jobset" constraints are
# semantically unnecessary (because they're implied by
# the eval), but they give a factor 1000 speedup on
# the Nixpkgs jobset with PostgreSQL.
{ project => $project->name, jobset => $jobset->name, job => $job->name, outPath => $outPath },
{ rows => 1, columns => ['id'] });
if (defined $prevBuild) {
print STDERR " already scheduled/built as build ", $prevBuild->id, "\n";
$buildIds->{$prevBuild->id} = 0;