<div dir="ltr">I coded up an all_equal gufunc <a href="https://github.com/mattharrigan/numpy_logical_gufuncs">here</a>.  Benchmark results are also in that repo.  For the specific problem in the book which started this, its 40x faster than the optimized code in the book.  For large arrays which have any early non equal element, its dramatically faster (1000x) than the current alternative.  For large arrays which are all equal, its ~10% faster due to eliminating the intermediate boolean array.  For tiny arrays its much faster due to a single function call instead of at least two, but its debatable how relevant speed is for tiny problems.  Disclaimer: this is my first ufunc I have every written.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 10, 2017 at 8:27 PM, Chris Barker - NOAA Federal <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> It seems a generalized ufunc "all_equal" with signature (i),(i)->() and short circuit logic once the first non equal element is encountered would be an important performance improvement.<br>
<br>
</span>How does array_equal() perform?<br>
<br>
-CHB<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/<wbr>mailman/listinfo/numpy-<wbr>discussion</a><br>
</div></div></blockquote></div><br></div>