*No!*  This is one of the most common misconceptions about Julia 
programming.

The type declarations in function arguments have *no impact* on 
performance.  Zero.  Nada.  Zip.  You *don't have to declare a type at all* 
in the function argument, and it *still* won't matter for performance.

The argument types are just a filter for when the function is applicable.

The first time a function is called, a specialized version is compiled for 
the types of the arguments that you pass it.  Subsequently, when you call 
it with arguments of the same type, the specialized version is called.

Note also that a default argument foo(x, y=false) is exactly equivalent to 
defining

    foo(x,y) = ...
    foo(x) = foo(x, false)

So, if you call foo(x, [1,2,3]), it calls a version of foo(x,y) specialized 
for an Array{Int} in the second argument.  The existence of a version of 
foo specialized for a boolean y is irrelevant.

Reply via email to