hi,
I am trying use @async
but it seems I am not using it properly. My code looks like something below. Note url
is a dummy name.
using EzXML
function test1()
item = ["name1", "name2","name3"]
url = "http://my.website/web-service/value="
xdoc = Vector(undef, 3)
for i in 1:3
xdoc[i] = EzXML.readxml(string(url,item[i]))
end
return xdoc
end
function test2()
item = ["name1", "name2","name3"]
url = "http://my.website/web-service/value="
xdoc = Vector(undef, 3)
@sync for i in 1:3
@async xdoc[i] = EzXML.readxml(string(url,item[i]))
end
return xdoc
end
@time test1()
7.21 seconds (102k allocations: 7.047 KiB)
@time test2()
7.33 seconds (318k allocations: 26.156 KiB)
I would expect test2 to be faster but it is not. Would you be able to help?
Thank you
Kind regards