I’ve just started using Julia and was trying to understand how macros work. I ran two simple tests with the macros devec and parallel and it seems to be getting slower instead of faster. Here are the two simple tests I ran:
First, with @devec:
a = ones(10)
b = ones(10)*5
@devec c = a.*b
elapsed time: 0.016007498 seconds
as opposed to
elapsed time: 0.00013638 seconds.
a = ones(10000)*0.5
sumOfSquares = @parallel (+) for i in 1:10000
elapsed time: 0.04703732 seconds
whereas not using the macro with the following code:
sumOfSquares = 0
for i in 1:10000
sumOfSquares += a[i]^2
elapsed time: 0.007251497 seconds.