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!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With