<div dir="ltr"><div style>><span style="font-family:arial,sans-serif;font-size:13px">Each ndarray does two mallocs, for the obj and buffer. These could be combined into 1 - just allocate the total size and do some pointer >arithmetic, then set OWNDATA to false.</span></div>
<div style>So, that two mallocs has been mentioned in project introduction. I got that wrong. <br></div><div><br></div><div>><span style="font-family:arial,sans-serif;font-size:13px">magnitude more time in inefficient loop selection and unnecessary writes to the FP control word?</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px">loop selection, contribute around 2~3% in time. I implemented cache with </span><font face="arial, sans-serif">PyThreadState_GetDict() but it didnt help. </font></div>
<div style><font face="arial, sans-serif">Even generating prepopulated dict/list in code_generator/generate_umath.py</font><span style="font-family:arial,sans-serif"> is not helping, </span></div><div><br></div><div style>
<br></div><div style>Here, it the distribution of time, on addition operations. All memory related and BuildValue operations cost more than 7%, rest looping ones are around 2-3%:</div><ul style><li style>PyUFunc_AddititonTypeResolver(7.6%)<br>
</li><ul style><li style><b>SimpleBinaryOperationTypeResolver(6.2%)</b></li></ul></ul><ul style><li style><b>execute_legacy_ufunc_loop(20.7%)</b><br></li><ul style><li style>trivial_three_operand_loop(8.6%)  ,this will be around 3.4% when pr #<a href="https://github.com/numpy/numpy/pull/3521">3521</a> get merged</li>
<li style><b>PYArray_NewFromDescr(7.3%)</b></li><li style>PyUFunc_DefaultLegacyInnerLoopSelector(2.5%)</li></ul></ul><ul style><li style>PyUFunc_GetPyValues(12.0%)<br></li><ul style><li style><b>_extract_pyvals(9.2%)</b></li>
</ul><li style><b>PyArray_Return(14.3%)</b></li></ul><div class="gmail_extra"><br>-- <br><div dir="ltr"><div style="outline-style:none">Arink Verma<br></div><div style="outline-style:none"><a href="http://www.arinkverma.in" target="_blank">www.arinkverma.in</a><br>
</div><div style="outline-style:none"></div></div>
</div></div>