I'm pretty sure yes. And it seems like a little strange thing to do..

You can use the code_native function to see the code and I did something 
wrong so I'm not sure I confirmed, but you could try out with and without 
bool (and Union). If you get lots of code then the length (longer) should 
be a hint..

Another thing I recall from the (performance) docs. You may want to check 
the bool and do one thing and then call another that does your array work 
that doesn't take a union. I think that applies here.

I've read a lot on Julia - but kind of a newbie.. so to not just trust me 
:) Someone might also confirm..

When I first read this, I thought the bool would be for for each individual 
value of the array. That would also be slow.. Often a NaN or other value is 
used it that case. Reserving a value would be slow and slower than NaN. 
Could you do the same as you are doing and have an array of only NaN be 
your signal? That could be just a 1x1 array.. but be sure to test if there 
are exceptions.. Anyway all NaN array is probably never helpful for you?

-- 
Palli.

On Friday, May 29, 2015 at 7:50:26 PM UTC, Seth wrote:
>
> I have an function that takes an optional (potentially very large) matrix 
> (AbstractArray{Float64,2}). I'd like to create a parameter to the function 
> that's EITHER this array, or a boolean (false). If I define
>
> edge_dists::Union(Bool, AbstractArray{Float64,2}) = false
>
>
>
> in my function declaration, would that cause significant performance 
> penalties when accessing the parameter?
>

Reply via email to