Controls the number of times the bench method is executed. To establish a baseline, it is necessary to execute the bench method multiple times. This allows the Stats tool to compute the mean, median, maximum, minimum, and standard deviation for the runs. Using these statistics, you can determine the stability of the benchmark. To show the affect of code changes, a stable baseline is necessary.The Stats tool does not display progress information while a bench method is executing (to minimize garbage and be unobtrusive).Executing a bench method builds a benchmark. The same bench method is used to establish a baseline and to optimize the operation of interest. This is achieved by specifying how the bench method should be executed. A bench method can be executed in one of the following ways:When you run a bench method (using the Run button), a new benchmark is built. The benchmark contains the raw execution time and the time spent collecting garbage. The operation of interest runs at full speed and no data is gathered while the method executes. Running a bench method accurately captures the raw time spent in the area of interest.To observe the behavior of the code before attempting to optimize it, a programmer usually builds and deletes many benchmarks. (The Delete button, or the equivalent Delete of the Bench menu, discards runs.) During this process, each benchmark is assessed for stability. Usually a single benchmark is chosen as the baseline for future comparisons.When you sample a bench method (using the Sample button), the benchmark contains all the information of a run [R] as well as data that is gathered by sampling the execution stack. This means that sampling a bench method takes somewhat longer than running the same bench method, due to the overhead of gathering data. When a bench method is sampled, the time spent gathering data is automatically subtracted from the time spent in the operation of interest.When you trace a benchmark (using the Trace button), data is gathered for every message-send operation. Results from a traced benchmark are viewed in the same way as the results of a sampled benchmark. A traced benchmark is indicated by [T].
|