Previously I did it using @time
. A few weeks ago I stopped timing anything in Juno and moved to scripts because of the discrepancy so I don’t have very recent experience.
Here are some results using BenchmarkTools.jl, which may not actually be as informative. This not a MWE, I would be happy to run something specific to see if there is any issue with my configuration. These are from running benchmarks for SequentialMonteCarlo.jl. The exact same code can be run by
Pkg.add("SequentialMonteCarlo"); Pkg.checkout("SequentialMonteCarlo")
Pkg.add("SMCExamples"); Pkg.checkout("SMCExamples")
and then running the equivalent of
JULIA_NUM_THREADS=4 julia -O3 test/runbenchmarks.jl
in Juno or as a script
in the SequentialMonteCarlo folder. The time differences are smaller than I remember them being but also quite variable; the more reliable results may be for the longer running functions where the factor is around 1.3. Perhaps this is because @btime
reports the minimum recorded time and we may be more interested here in average time; we’re not really benchmarking the function when trying to compare execution environments. It also seems that running the file in Juno is better than running line-by-line, although usually when I’m using Juno to run code I am running line-by-line.
Running the script (as also listed https://awllee.github.io/SequentialMonteCarlo.jl/latest/bench.html):
x86_64-apple-darwin14.5.0
Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz (haswell) ; 2 Physical, 4 Logical
Julia 0.6.2 using 4 threads
Linear Gaussian Model, n = 10
log₂N Benchmark
10 300.061 μs (58 allocations: 2.13 KiB)
15 7.858 ms (58 allocations: 2.13 KiB)
20 339.166 ms (58 allocations: 2.13 KiB)
Multivariate Linear Gaussian Model, d = 10, n = 10
log₂N Benchmark
10 1.969 ms (58 allocations: 2.13 KiB)
15 65.497 ms (58 allocations: 2.13 KiB)
20 2.175 s (58 allocations: 2.13 KiB)
SMC Sampler Example, n = 12
log₂N Benchmark
10 3.926 ms (70 allocations: 2.56 KiB)
15 128.009 ms (70 allocations: 2.56 KiB)
20 4.325 s (70 allocations: 2.56 KiB)
Lorenz96 Example, d = 8, n = 10
log₂N Benchmark
10 13.381 ms (58 allocations: 2.13 KiB)
15 436.527 ms (58 allocations: 2.13 KiB)
20 14.559 s (58 allocations: 2.13 KiB)
Running the file in Juno:
x86_64-apple-darwin14.5.0
Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz (haswell) ; 2 Physical, 4 Logical
Julia 0.6.2 using 4 threads
Linear Gaussian Model, n = 10
log₂N Benchmark
10 330.098 μs (58 allocations: 2.13 KiB)
15 8.011 ms (58 allocations: 2.13 KiB)
20 500.772 ms (58 allocations: 2.13 KiB)
Multivariate Linear Gaussian Model, d = 10, n = 10
log₂N Benchmark
10 2.156 ms (58 allocations: 2.13 KiB)
15 102.722 ms (58 allocations: 2.13 KiB)
20 2.779 s (58 allocations: 2.13 KiB)
SMC Sampler Example, n = 12
log₂N Benchmark
10 3.983 ms (70 allocations: 2.56 KiB)
15 189.158 ms (70 allocations: 2.56 KiB)
20 5.750 s (70 allocations: 2.56 KiB)
Lorenz96 Example, d = 8, n = 10
log₂N Benchmark
10 18.312 ms (58 allocations: 2.13 KiB)
15 531.985 ms (58 allocations: 2.13 KiB)
20 18.683 s (58 allocations: 2.13 KiB)
Finished: Wed, 20 Dec 2017 16:39:27
Running line by line in Juno:
x86_64-apple-darwin14.5.0
Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz (haswell) ; 2 Physical, 4 Logical
Julia 0.6.2 using 4 threads
Linear Gaussian Model, n = 10
log₂N Benchmark
10 300.117 μs (58 allocations: 2.13 KiB)
15 7.963 ms (58 allocations: 2.13 KiB)
20 569.123 ms (58 allocations: 2.13 KiB)
Multivariate Linear Gaussian Model, d = 10, n = 10
log₂N Benchmark
10 1.996 ms (58 allocations: 2.13 KiB)
15 118.719 ms (58 allocations: 2.13 KiB)
20 3.255 s (58 allocations: 2.13 KiB)
SMC Sampler Example, n = 12
log₂N Benchmark
10 3.835 ms (70 allocations: 2.56 KiB)
15 196.697 ms (70 allocations: 2.56 KiB)
20 5.953 s (70 allocations: 2.56 KiB)
Lorenz96 Example, d = 8, n = 10
log₂N Benchmark
10 20.557 ms (58 allocations: 2.13 KiB)
15 602.407 ms (58 allocations: 2.13 KiB)
20 19.680 s (58 allocations: 2.13 KiB)