So here is a reason for keeping the linespace a vector:

julia> t = linspace(0, 1, 1_000_000);
julia> s = collect(t);
julia> @time for n = 1:10; exp(t); end
  0.209307 seconds (20 allocations: 76.295 MB, 3.42% gc time)
julia> @time for n = 1:10; exp(s); end
  0.054603 seconds (20 allocations: 76.295 MB, 17.66% gc time)
julia> @time for n = 1:10; AppleAccelerate.exp(s); end
  0.016640 seconds (40 allocations: 76.295 MB, 31.64% gc time)
julia> @time for n = 1:10; AppleAccelerate.exp!(s,s); end
  0.005702 seconds

Now the natural response will be to say that most of the time I won't care 
so much about performance, and when I do, then I can go optimise. But in 
truth the same can be said about keeping linspace abstract just because it 
saves memory. (obviously it is not faster!) 

I think the argument for abstract types is very strong, but (in my personal 
view) not at the expense of expected behaviour.

Christoph


Reply via email to