Implement "target time" for benchmarks #17
Merged
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.
On certain benchmarks, the predict method completes orders of magnitude faster than the fit method. Instead of requiring the user to manually select number of repetitions to run, this PR implements aiming for a certain target total time instead. This should help with measurement stability in these benchmarks.
The timing function first takes some "warmup" measurements and determines a good number of inner loops such that the total timing meets the overall time limit and includes about
--goal-outer-loops
outer loops. If the warmup measurement time exceeds the time limit, the timing function just returns the warmup time.This PR also includes some refactoring of native benchmarks to use common functions for counting classes, printing tables, and timing.
One other change made here is to use
tol=0
in all kmeans benchmarks unless otherwise specified on the command-line. This removes randomness in number of iterations in K-Means fit.