On Thu, Jan 20, 2022 at 4:10 PM Sebastian Berg <sebast...@sipsolutions.net>
wrote:


> Thanks for figuring this out!  It has been bugging me a lot before.  So
> it rather depends on how `malloc` works, and not the kernel.  It is
> surprising how "random" this can look, but I suppose some examples just
> happen to sit almost exactly at the threshold.
>

Also, one should be aware that temporaries can appear in many situations in
NumPy, it is not exactly easy to predict when this is going to bit you.  In
Warren's example he already noticed that the difference in performance was
only noticeable when a complex expression was used ('z.real**2 +
z.imag**2', so with temporaries), whereas a simple expression ('z.real +
z.imag', no temporaries) did not trigger the behavior.


>
> It might be interesting if we could tweak `mallopt` parameters for
> typical NumPy usage.  But unless it is very clear, maybe a standalone
> module is better?
>

Well, I can see `mallopt` handling being useful just for NumPy purposes,
but it is up to you to decide where to put this logic.

> All in all, this is testimonial of how much memory handling can
> > affect
> > performance in modern computers.  Perhaps it is time for testing
> > different
> > memory allocation strategies in NumPy and come up with suggestions
> > for
> > users.
>
> You are probably aware, but Matti and Elias now added the ability to
> customize array data allocation in NumPy, so it should be straight
> forward to write a small package/module that tweaks the allocation
> strategy here.
>

That's good to hear.

Cheers,
-- 
Francesc Alted
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to