3 ms·
Am I the only person not seeing the promised performance with Julia? As a concrete example I recently ported some non-trivial legacy matlab code I use at work
by dagw 12y ago
Am I the only person not seeing the promised performance with Julia? As a concrete example I recently ported some non-trivial legacy matlab code I use at work to both python/numpy and Julia. The port was basically a straight port of matlab code making only the necessary syntax changes to make the code run. And much to my surprise Julia run twice as slow as Octave and 4 times as slow as python. Adding type annotations helped but I never got closer than 50% slower than Octave. In earlier test I've seen cases where Julia was literally 12 times slower than python/numexpr in real world code.
I really want to love Julia and everything I read about it makes me think it's the language for me, but every time I try to write non-toy code the performance is always worse than python.
- jostmey 12y agoI've observed a huge performance boost over python -- I wrote a simple artificial neural network trained using backpropagation in both languages and my Julia code ran orders of magnitude faster. Something is clearly screwed up with your implementation of Julia. There is no way octave should be running faster.
- grayclhn 12y agoOctave occasionally runs faster than Julia for transliterated vectorized vector and matrix operations. Julia then runs much faster when those operations are devectorized or replaced with builtin functions. But that's a pretty common source of these issues (at least on the mailing list.)
- ViralBShah 12y agoIt would be good to know where we are slow, so that we can fix it. Can you for an issue with an example on github?
- grayclhn 12y agoI'll do it right now. These aren't issues I've personally run across, though, just stuff on julia-users. edit: Nevermind! On rereading the mailing list thread (especially this message [1]), I might have mischaracterized the issue slightly. It probably came from speed issues with small integer powers (i.e., there are faster ways to exponentiate small integer powers than there are for general exponentiation that Julia hadn't been using but other software like matlab and octave were), and that issue in Julia seems to be fixed now.[2] [1] https://groups.google.com/d/msg/julia-users/n3LfteWJAd4/jag6AZNvSEsJ https://groups.google.com/d/msg/julia-users/n3LfteWJAd4/jag6... [2] https://github.com/JuliaLang/julia/issues/2741 https://github.com/JuliaLang/julia/issues/2741
- grayclhn 12y agoDid you read the performance tips?[1] The mailing list is pretty good at helping with problems like that. Using global variables is a pretty common performance killer. [1] http://julia.readthedocs.org/en/latest/manual/performance-tips/ http://julia.readthedocs.org/en/latest/manual/performance-ti... edit: As a direct reply to your question, yes, lots of people fail to find performance improvements when they first port code to Julia. But they often discover those improvements 10 minutes after someone with more Julia experience looks over their code :)
- srean 12y ago> The port was basically a straight port of matlab code making only the necessary syntax changes to make the code run. Then it is not surprising at all that you do not get any speed benefit. I would expect a serious slowdown. Idiomatic MATLAB and Numpy has lots of vectorized expressions because they are so crappy at loops. However, in vanilla Julia those vectorized expressions cannot be JIT'ed. Now if you were to write them out as explicit loops then JIT will take a stab at making things faster. I do like the economy of words of vectorized expressions a whole lot, this is the reason why I am so excited about https://github.com/lindahua/Devectorize.jl https://github.com/lindahua/Devectorize.jl
- ViralBShah 12y agoOn vectorized code we are on par usually, but sometimes GC performance hurts. There is a patch for this in the works. Could you post the code snippets to julia-users mailing list?