Speed up prevector tests by parallelization #8632
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The prevector tests are really slow when run under wine. This needs to be fixed because it can cause failures during development if one adds new tests timeouts can be hit in travis. This PR adds 3 worker threads + one master to mitigate performance, and removes unnecessary full testing setup. This PR makes the test time go from 205 seconds to 3.7 seconds.
I selected the magic number 4 because that is what I had read in the travis docs as a good number. I also switch from TestingSetup to BasicTestingSetup because TestingSetup spawns unused threads
Prevector tests should be sped up by some other means too, but that doesn't preclude parallelization as done in this PR.
Benchmarks
On a 64-bit windows build off of master, I see:
real 3m24.907s
user 3m24.705s
sys 0m0.038s
After parallelization:
real 0m4.170s
user 0m4.492s
sys 0m9.319s
After parallelization+switch to BasicTestingSetup:
real 0m3.782s
user 0m3.972s
sys 0m6.615s
Analysis
I'm pretty surprised at the speedup; I did test before PR'ing that:
So I feel pretty confident in the correctness that all checks are run and errors reported, but perhaps there is something I've missed. My theory is the speedup has to do with the wine runtime having high overhead with the main thread.
Testing with a single worker thread doing all the checks gives:
real 0m4.682s
user 0m4.444s
sys 0m0.037s
Which seems to confirm my theory (I've left the 4 threaded version because it's marginally faster).