Hi 

I'm looking for some advice for some on writing methods on large 
(memory-wise) data types. Is there an overhead difference in the following 
two methods?

type State
   hugearray1::Array{Float64, 2}
   hugearray2::Array{Float64, 2}
   ... # Many more components
end

function style1!(s::State)
     complicated_function(s.hugearray1)
end

function style2!(arr::Array{Float64, 2})
     complicated_function(arr)
end

# difference in calls:

s = State(arr1, arr2, ...)
style1!(s)                   # Pretty but is it slower?
style2!(s.hugearray1)        # Ugly but is it faster?


Basically, is there an overhead in throwing the whole state datatype into a 
function even if i only manipulate one or two of the potentially large 
amount of components or should I be making functions in the second style 
where arguments are exactly of the type of the components being manipulated.

Thanks!
Nathan

ps: sorry for the double post, I hit enter before I finished writing..

Reply via email to