Performance of functions with keyword arguments

Perhaps:

julia> f_kw(x; y = 3) = x + y
f_kw (generic function with 1 method)

julia> f(x, y = 3) = x + y
f (generic function with 2 methods)

julia> @btime f_kw(2);
  1.789 ns (0 allocations: 0 bytes)

julia> @btime f_kw(2, y = 3);
  66.668 ns (1 allocation: 96 bytes)

julia> @btime f(2);
  1.789 ns (0 allocations: 0 bytes)
6 Likes