You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2023. It is now read-only.
Here, we see a bimodal distribution; in the case `5` is indeed in the vector, we find it very quickly, in the 0-1000 ns range (thanks to `sort` which places it at the front). In the case 5 is not present, we need to check every entry to be sure, and we end up in the 3000-4000 ns range.
@@ -60,14 +73,51 @@ Without the `sort`, we end up with more of a uniform distribution:
See also <https://tratt.net/laurie/blog/entries/minimum_times_tend_to_mislead_when_benchmarking.html> for another example of where looking at the whole histogram can be useful in benchmarking.
Copy file name to clipboardExpand all lines: generate_readme/README.jl
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@
11
11
12
12
# Providing this functionality in BenchmarkTools itself was discussed in <https://github.com/JuliaCI/BenchmarkTools.jl/pull/180>.
13
13
14
+
# Use the setting `BenchmarkPlots.NBINS[] = 10` to change the number of histogram bins used.
15
+
14
16
# ## Example
15
17
16
18
# One just uses `BenchmarkPlots` instead of `BenchmarkTools`, e.g.
@@ -29,4 +31,11 @@ using BenchmarkPlots
29
31
30
32
@benchmark5∈ v setup=(v =rand(1:10000, 10000))
31
33
34
+
# This function gives a somewhat more Gaussian distribution of times, kindly supplied by Mason Protter:
35
+
36
+
f() =sum((sin(i) for i in1:round(Int, 1000+100*randn())))
37
+
38
+
@benchmarkf()
39
+
40
+
32
41
# See also <https://tratt.net/laurie/blog/entries/minimum_times_tend_to_mislead_when_benchmarking.html> for another example of where looking at the whole histogram can be useful in benchmarking.
0 commit comments