0f271b9f

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Let a test group bound how many of it run at once

Parallelism was Parallel or Sequential, so a group whose tests contend
for something the suite does not own had one instrument available: stop
them all from overlapping.

That is more than such a group usually needs. Tests sharing one database
server, with a database each, slow each other down past some number of
them at once, not past one. In nix-ci's cache garbage collector spec,
which is where this came up, the difference is worth measuring: that
spec takes 20s with one test at a time and 6s with four, against 3s
unbounded. Sequential buys the quiet at three times the wall clock of a
bound that would have been just as quiet.

So add a bound. ParallelWith n still queues its tests like any other,
and holds them at a semaphore of n on the way in, so it only ever runs
fewer of them than the threads would allow, never more.

The semaphore is made when the runner enters the node, so everything
below one ParallelWith shares one bound rather than each group below it
getting its own. The runner's environment carries it already resolved,
which is why it holds a RunParallelism rather than the Parallelism the
spec tree is written in: a bound with no semaphore should not be a state
this can be in.

Parallelism is exported with all its constructors, so an exhaustive
match on it now needs a third case. That is a major version under the
PVP, however much this reads like an addition. Nothing in the repo
bounds sydtest from above, so no dependent needs moving.

Total

46m49s

Created Started Finished

Time to Start Worker time Duration Time to finish Idle
Config 20s 1s 1s 22s 20s
Eval 23s 1m19s 1m19s 1m43s 1s
Build 1m42s 2m06s 45m27s 47m10s 43m20s
Suite 20s 3m27s 46m49s 47m10s 43m42s

Timeline

Config Eval Build Compressed gap
0s40s1m1m20s1m40s45m20s45m40s46m46m20s46m40s47m