<story><title>How to Make Python Run as Fast as Julia</title><url>https://www.ibm.com/developerworks/community/blogs/jfp/entry/Python_Meets_Julia_Micro_Performance</url></story><parent_chain></parent_chain><comment><author>jordigh</author><text>I don&amp;#x27;t think this is accurately representing Julia&amp;#x27;s aims. Of course the Julia team wrote the Python code in a way that makes it run slowly. But it looks like perfectly natural Python code! It&amp;#x27;s almost a literal translation of the Julia code. Julia&amp;#x27;s benchmark is even far worse with Octave, which they almost deliberately wrote in the worst way possible for Octave, with lots of loops and recursion.&lt;p&gt;We have written some documentation for Octave in order to guide people towards writing faster Octave code:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.gnu.org&amp;#x2F;software&amp;#x2F;octave&amp;#x2F;doc&amp;#x2F;interpreter&amp;#x2F;Vectorization-and-Faster-Code-Execution.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.gnu.org&amp;#x2F;software&amp;#x2F;octave&amp;#x2F;doc&amp;#x2F;interpreter&amp;#x2F;Vectoriz...&lt;/a&gt;&lt;p&gt;But look at how much we have to explain, and look at all the hoops we have to jump through in Python and Octave in order to write faster code. Matlab used to have similar guides telling people don&amp;#x27;t write this, write that instead.&lt;p&gt;What Matlab eventually did was look at what people were writing and making that fast. Julia did the same and made it even faster.&lt;p&gt;This is a lesson from C and C++ compilers that seems to be taking a long time to trickle to other programming languages: as long as you&amp;#x27;re writing reasonable code, speeding up your code is your &lt;i&gt;compiler&lt;/i&gt;&amp;#x27;s job, not yours. Your compiler usually knows better than you how to unroll loops, how to cache results, how to use multiple cores, how to elide unnecessary intermediate results, how to completely remove dead code. You should focus on writing easy to understand, maintainable, high-level code. That&amp;#x27;s why you&amp;#x27;re using a programming language and not machine code.</text></comment>
<story><title>How to Make Python Run as Fast as Julia</title><url>https://www.ibm.com/developerworks/community/blogs/jfp/entry/Python_Meets_Julia_Micro_Performance</url></story><parent_chain></parent_chain><comment><author>thebooktocome</author><text>The point of the Julia benchmarks was to show &lt;i&gt;compiler&lt;/i&gt; performance.&lt;p&gt;You can do something clever in any language. There are plenty of really, really smart people that spend a lot of time writing incomprehensible (to me) Haskell that outperforms C.&lt;p&gt;The question is, do you &lt;i&gt;have&lt;/i&gt; to do something clever to get performant code in the language of your choice?&lt;p&gt;In Julia -- not often. I&amp;#x27;ve written around 50kloc of Julia; almost all of it is first-pass prototype code that manages to be performant despite itself. The most polished code I&amp;#x27;ve written in Julia is about 100x faster than the MATLAB it replaced.&lt;p&gt;IMO, the main advantage of Python is its massive library of modules. As a prototyping language, on the other hand, it just seems to me that Julia is more flexible.</text></comment>