Autotuning a parameter according to benchmark

Has someone already created a harness that runs a benchmark function with different values for an integer (usize) argument to the benchmarked function to find out what value for the argument yields the best performance?

Use case: Tuning the task splitting threshold for rayon.