I am finding that function call cost increases significantly when omitting an optional keywrd argument in a function. For example, consider
foo = jit(lambda a, b=2: a + b)
If this is called without passing the kwarg, i.e. foo(1), it takes ~10 microseconds on my machine. If the kwarg is passed, i.e. foo(1, b=2) the time goes to 70 nanoseconds. Interestingly calling foo(1, 2) further reduces the cost to ~50 nanoseconds, but that’s beside my original point.
Setting default arguments is very useful and this is prohibiting me from exposing efficient routines directly to Python code. Any suggestions?