如果我想在Julia中进行计算
invQa = ChebyExp(g->1/Q(g),0,1,5)
a1Inf = ChebyExp(g->Q(g),1,10,5)
invQb = ChebyExp(g->1/Qd(g),0,1,5)
Qb1Inf = ChebyExp(g->Qd(g),1,10,5)
我该如何计算时间?等四件事情完成需要等待多少秒?我是在开头放置tic()
,在结尾放置toc()
吗?
我尝试使用@elapsed
,但没有结果。
function cheby_test(g::Your_Type)
invQa = ChebyExp(g->1/Q(g),0,1,5)
a1Inf = ChebyExp(g->Q(g),1,10,5)
invQb = ChebyExp(g->1/Qd(g),0,1,5)
Qb1Inf = ChebyExp(g->Qd(g),1,10,5)
end
function test()
g::Your_Type = small_quick #
cheby_test(g) #= function is compiled here and
you like to exclude compile time from test =#
g = real_data()
@time cheby_test(g) # here you measure time for real data
end
test()
using BenchmarkTools; @btime begin...
- Michael K. Borregaard