&gt; once I had a decent algorithm, I could turn to Cython to tighten up the bottlenecks and make it fast.<p>What are your preferred ways to profile Python code? Coming recently from PHP, where we have XDebug&#x2F;KCachegrind, the excellent Facebook-sponsored Xhprof, <a href="https:&#x2F;&#x2F;blackfire.io" rel="nofollow">https:&#x2F;&#x2F;blackfire.io</a> and <a href="https:&#x2F;&#x2F;tideways.io" rel="nofollow">https:&#x2F;&#x2F;tideways.io</a>, it&#x27;s felt a step backwards.<p>I&#x27;ve tried line_profiler, and used memory_profiler and cProfile with pyprof2calltree and KCachegrind. I&#x27;ve found the cProfile output confusing when it crosses the Python-C barrier for numpy, sklearn etc.