Float32 is fine, although better would be to make Data a parametric type:
type Data{T<:FloatingPoint}
cum::Array{T, 1}
i::Int
end
With integers, it's best to use Int because that will ensure you're using
native arithmetic, no matter which platform you're on. Int = Int32 on 32-bit,
Int = Int64 on 64-bit.
--Tim
On Monday, May 12, 2014 10:27:56 PM cnbiz850 wrote:
> I am on 64bits Ubuntu. Should I better not use type 32 (Float32, Int32
> etc.) on 64bit system?
>
> On 05/12/2014 10:23 PM, Tim Holy wrote:
> > Are you on 32 bit or 64 bit? If 64, an Int32 +/- 1 generates an Int64. Why
> > not just declare i to be an Int?
> >
> > --Tim
> >
> > On Monday, May 12, 2014 09:53:50 PM cnbiz850 wrote:
> >> Profile shows the two lines in the function being very expensive. Is
> >> there anything inappropriate? Any way to improve?
> >>
> >> function NoUpdate(data::Data)
> >>
> >> data.cum[data.i] = data.cum[data.i-1]
> >> data.i += 1
> >>
> >> end
> >>
> >> type Data
> >>
> >> cum::Array{Float32,1}
> >> i::Int32
> >> ...
> >>
> >> end