Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing multiple versions/branches of a module to benchmark in Julia

How can I use several different versions or branches of the same module in a single script in Julia?

e.g. If I wanted to benchmark each of the tagged releases.

(Someone asked a similar question recently and I answered the wrong one but though this might be useful anyway.)

Edit: I have answered this myself but I am sure their may be a better way!

like image 837
Alexander Morley Avatar asked Aug 30 '16 10:08

Alexander Morley


1 Answers

You can just git checkout a different version of the module and then use benchmarkTools.jl to benchmark. However it may be better to use multiple scripts though (or at least ignore the first trial) (See this comment Importing multiple versions of the same Module/Package for Benchmarking for more info).

e.g.

packagedir = Pkg.dir("DSP")
version2checkout = "v0.0.7"
run(`cd $packagedir`); run(`git checkout tags/$version2checkout`)
import DSP
# do all your benmarking stuff
# start again

Prevents you from having to copy the modules but still a little clunky I guess. You could even do it in a loop for lots of versions by capturing the output of git tag

for i in readlines(`git tag`)
    version2checkout = chomp(i)
    # checkout version and benchmark
end
like image 112
Alexander Morley Avatar answered Sep 29 '22 05:09

Alexander Morley