That is an atrocious performance...

Maybe one of the dirty tricks discussed in this thread could help:
https://groups.google.com/d/msg/julia-users/A0DGzPVfiAI/0nYSjtC29eUJ

Or, you could construct your type IM using a macro which would
automatically also produce a @set_IM macro?

On Wed, 2015-02-18 at 13:33, Ariel Keselman <[email protected]> wrote:
> The problem is performance -- `reconstruct` is ~100X slower than the macro in
> the benchmark below. The macro solution is as fast as having mutating data
> actually, too bad it is no completely generic...
>
> a = [IM(0,0,0,0,0,0,0,0,0,0,0,0) for i in 1:1000000];
>
> function frec(arr::Array{IM,1})
>     for j in 1:100
>         for i in 1:1000000
>             @inbounds arr[i] = reconstruct(a[i], [(:aa, 1),(:bb,2)])
>         end
>     end
>     arr[1].aa+arr[1000000].bb
> end
>
> function fim(arr::Array{IM,1})
>     for j in 1:100
>         for i in 1:1000000
>             @set arr i aa=1 bb=2
>         end
>     end
>     arr[1].aa+arr[1000000].bb
> end

Reply via email to