The speed difference is likely due to some memory caching of the contents of a
and b
that the second call to linalg.solve
takes advantage of.
And to answer the question, objects in python are passed by reference, so the only differencein the cost of passing arguments is that you are doing it twice in the 2nd example. But that is probably a tiny fraction of the solve cost.