that did help, second run is now 1.425! What does the B[:] do exactly?
On Monday, March 3, 2014 8:44:59 PM UTC-5, Keno Fischer wrote: > > Try `@devec B[:] = exp(A)` > > > On Mon, Mar 3, 2014 at 8:39 PM, Jason Solack <[email protected]<javascript:> > > wrote: > >> that did help a lot: >> >> function testSpeed() >> A = rand(100000000) >> B = zeros(Float64, size(A, 1)) >> tic() >> B = exp(A) >> toc() >> >> tic() >> @devec B = exp(A) >> toc() >> >> >> end >> >> testSpeed() >> >> >> but it's still a little slower.. the above example is 1.515 in the first >> test and 1.533 in the second >> >> >> >> On Monday, March 3, 2014 8:31:59 PM UTC-5, Stefan Karpinski wrote: >> >>> Global >>> scope<http://julia.readthedocs.org/en/latest/manual/performance-tips/#avoid-global-variables> >>> ? >>> >>> >>> On Mon, Mar 3, 2014 at 8:16 PM, Jason Solack <[email protected]> wrote: >>> >>>> Hello all. I am trying to use Devectorize to speed up some code i have >>>> written but it's having the opposite effect. Am i doing something wrong? >>>> Take this example >>>> >>>> >>>> A = rand(1000000) >>>> B = zeros(Float64, size(A, 1)) >>>> >>>> tic() >>>> B = exp(A) >>>> toc() >>>> >>>> tic() >>>> @devec B = exp(A) >>>> toc() >>>> >>>> >>>> in the first exp runs in 0.02319 seconds on my machine, the second runs >>>> in .2664 seconds... i expected the opposite to happen! >>>> >>>> Thank you for any help on understanding how this macro works! >>>> >>>> Jason >>>> >>> >>> >
