edbennett / performant-numpy

A lesson on ways to write Numpy code that is performant
Other
1 stars 2 forks source link

out kwarg in numpy operations #9

Open chillenzer opened 1 year ago

chillenzer commented 1 year ago

The out kwarg in numpy arrays allows to pre-allocate arrays and thereby avoid unnecessary allocations. This is often the first and easiest optimization. We should consider using it, e.g. benchmark some of the present examples and/or create a specific example where this shines. Even if it isn't more efficient than the numba approach, it might be a lower barrier.