You don't seem to have tried keyword arguments – these are usually the best
option if you have a large set of parameters to pass a single function.
They may not fit your use case but they might be interesting to benchmark
at least.


On 30 May 2014 10:42, Jon Norberg <jon.norb...@ecology.su.se> wrote:

> There have been several posts about this, so I tried to compile what I
> could find to compare speed and pretty coding:
>
>
> http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/38371278/Function%20parms%20passing%20speed%20test.ipynb
>
> Best speed is assigning values or variables inside the function
> Second best is reassigning parameters from array for each parameter. The
> @pack/@unpack macro also is pretty fast and much prettier
> Third best is separate parameters and global assignment (longer function
> call code if many parameters or/and just no no to use global?)
> Slowest is using indexed array as parameters in function (but this is ugly
> to read) and immutable types
>
> So I am wondering, did I miss any that improve speed/prettiness?
>
> Best, Jon
>
>
>
>

Reply via email to