Skip to content

Instantly share code, notes, and snippets.

@ggggggggg
Last active October 23, 2017 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ggggggggg/83340e3c54cb0cc0cbc51f5d1dcd74cd to your computer and use it in GitHub Desktop.
Save ggggggggg/83340e3c54cb0cc0cbc51f5d1dcd74cd to your computer and use it in GitHub Desktop.
stackexchange46809845
using BenchmarkTools
dirname = "anotherdir"
isdir(dirname) || mkdir(dirname)
fname = joinpath(dirname,"stackexchange46809845_f.jl")
funname = "myfun"
funstr = """$funname() = rand(100)"""
open(fname,"w") do f
write(f,funstr)
end
include(fname)
function_name = Symbol(funname)
f=getfield(Main, function_name)
println(@belapsed myfun())
println(@belapsed f())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment